Author: vitalybuka Date: Wed Jun 26 19:08:15 2019 New Revision: 364495 URL: http://llvm.org/viewvc/llvm-project?rev=364495&view=rev Log: [NFC] Return early for types with size zero
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=364495&r1=364494&r2=364495&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jun 26 19:08:15 2019 @@ -1145,6 +1145,10 @@ static void emitStoresForConstant(CodeGe 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 @@ static void emitStoresForConstant(CodeGe 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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits