diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-22 00:24:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-22 00:24:14 +0000 |
commit | 47640221da40680d17b0b18d5ce61f4cd6382a14 (patch) | |
tree | 024afd1e0ada1242452dab608ecc9ddb5d1b4aae /clang/lib/CodeGen/CGDecl.cpp | |
parent | adda37fb6219f56882f1f324b197209bfe2a2a24 (diff) | |
download | bcm5719-llvm-47640221da40680d17b0b18d5ce61f4cd6382a14.tar.gz bcm5719-llvm-47640221da40680d17b0b18d5ce61f4cd6382a14.zip |
fix CreateTempAlloca to not set a name on the alloca for temporaries
in release-assert builds. For automatic variables, explicitly set
a name with setName that does not make a temporary std::string.
This speeds up -emit-llvm-only -disable-free on PR3810 by 4.6%
llvm-svn: 67459
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 8a4febeecfb..49ac20a9bcd 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -232,8 +232,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { const llvm::Type *LTy = ConvertTypeForMem(Ty); if (isByRef) LTy = BuildByRefType(Ty, getContext().getDeclAlignInBytes(&D)); - llvm::AllocaInst *Alloc = - CreateTempAlloca(LTy, D.getNameAsString().c_str()); + llvm::AllocaInst *Alloc = CreateTempAlloca(LTy); + Alloc->setName(D.getNameAsString().c_str()); + if (isByRef) Alloc->setAlignment(std::max(getContext().getDeclAlignInBytes(&D), getContext().getTypeAlign(getContext().VoidPtrTy) / 8)); @@ -429,7 +430,8 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg) { // TODO: Alignment std::string Name = D.getNameAsString(); Name += ".addr"; - DeclPtr = CreateTempAlloca(LTy, Name.c_str()); + DeclPtr = CreateTempAlloca(LTy); + DeclPtr->setName(Name.c_str()); // Store the initial value into the alloca. EmitStoreOfScalar(Arg, DeclPtr, Ty.isVolatileQualified()); |