diff options
author | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 01:34:21 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 01:34:21 +0000 |
commit | 96ff25ad653c9a90619f9e6b1af23d977cb82e3c (patch) | |
tree | 9cadb9476004402b459da2121e935485c6a9f496 /clang/lib/CodeGen/CGDecl.cpp | |
parent | c5c8e287565dece32b28d8969fd77b6ebc6c4459 (diff) | |
download | bcm5719-llvm-96ff25ad653c9a90619f9e6b1af23d977cb82e3c.tar.gz bcm5719-llvm-96ff25ad653c9a90619f9e6b1af23d977cb82e3c.zip |
[NFC] Remove unneeded local variables
llvm-svn: 364492
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index d1e250e7ec5..a09b8fc5842 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1152,18 +1152,15 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D, return; } - auto *Int8Ty = llvm::IntegerType::getInt8Ty(CGM.getLLVMContext()); - auto *IntPtrTy = CGM.getDataLayout().getIntPtrType(CGM.getLLVMContext()); - uint64_t ConstantSize = CGM.getDataLayout().getTypeAllocSize(Ty); if (!ConstantSize) return; - auto *SizeVal = llvm::ConstantInt::get(IntPtrTy, ConstantSize); + auto *SizeVal = llvm::ConstantInt::get(CGM.IntPtrTy, ConstantSize); // If the initializer is all or mostly the same, codegen with bzero / memset // then do a few stores afterward. if (shouldUseBZeroPlusStoresToInitialize(constant, ConstantSize)) { - Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, 0), SizeVal, + Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, 0), SizeVal, isVolatile); bool valueAlreadyCorrect = @@ -1184,7 +1181,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D, assert(AP.getBitWidth() <= 8); Value = AP.getLimitedValue(); } - Builder.CreateMemSet(Loc, llvm::ConstantInt::get(Int8Ty, Value), SizeVal, + Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, Value), SizeVal, isVolatile); return; } @@ -1672,8 +1669,6 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { auto DL = ApplyDebugLocation::CreateDefaultArtificial(*this, D.getLocation()); QualType type = D.getType(); - bool isVolatile = type.isVolatileQualified(); - // If this local has an initializer, emit it now. const Expr *Init = D.getInit(); @@ -1728,6 +1723,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { if (emission.IsEscapingByRef && !locIsByrefHeader) Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false); + bool isVolatile = type.isVolatileQualified(); CharUnits Size = getContext().getTypeSizeInChars(type); if (!Size.isZero()) { switch (trivialAutoVarInit) { @@ -1849,7 +1845,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { llvm::Type *BP = CGM.Int8Ty->getPointerTo(Loc.getAddressSpace()); emitStoresForConstant( CGM, D, (Loc.getType() == BP) ? Loc : Builder.CreateBitCast(Loc, BP), - isVolatile, Builder, constant); + type.isVolatileQualified(), Builder, constant); } /// Emit an expression as an initializer for an object (variable, field, etc.) |