diff options
| author | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 02:08:15 +0000 |
|---|---|---|
| committer | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 02:08:15 +0000 |
| commit | f35a3456eafa82e93938164c804683cc312ce7ec (patch) | |
| tree | 4aa1cb45dfde8aeb3aaeb8a76fa1e0e18e95338d /clang/lib/CodeGen/CGDecl.cpp | |
| parent | d661a06bed4e383a8fa2ddca5849880e27d77fa8 (diff) | |
| download | bcm5719-llvm-f35a3456eafa82e93938164c804683cc312ce7ec.tar.gz bcm5719-llvm-f35a3456eafa82e93938164c804683cc312ce7ec.zip | |
[NFC] Return early for types with size zero
llvm-svn: 364495
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index a09b8fc5842..43c962d32ef 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1145,6 +1145,10 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D, 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(CodeGenModule &CGM, const VarDecl &D, 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 |

