[NFC] Return early for types with size zero
llvm-svn: 364495
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index a09b8fc..43c962d 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1145,6 +1145,10 @@
CGBuilderTy &Builder,
llvm::Constant *constant) {
auto *Ty = constant->getType();
+ uint64_t ConstantSize = CGM.getDataLayout().getTypeAllocSize(Ty);
+ if (!ConstantSize)
+ return;
+
bool canDoSingleStore = Ty->isIntOrIntVectorTy() ||
Ty->isPtrOrPtrVectorTy() || Ty->isFPOrFPVectorTy();
if (canDoSingleStore) {
@@ -1152,9 +1156,6 @@
return;
}
- uint64_t ConstantSize = CGM.getDataLayout().getTypeAllocSize(Ty);
- if (!ConstantSize)
- return;
auto *SizeVal = llvm::ConstantInt::get(CGM.IntPtrTy, ConstantSize);
// If the initializer is all or mostly the same, codegen with bzero / memset