[cfe-commits] r67459 - in /cfe/trunk/lib/CodeGen: CGDecl.cpp CGExpr.cpp CodeGenFunction.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 21 17:24:15 PDT 2009
Author: lattner
Date: Sat Mar 21 19:24:14 2009
New Revision: 67459
URL: http://llvm.org/viewvc/llvm-project?rev=67459&view=rev
Log:
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%
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=67459&r1=67458&r2=67459&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sat Mar 21 19:24:14 2009
@@ -232,8 +232,9 @@
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 @@
// 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());
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=67459&r1=67458&r2=67459&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Mar 21 19:24:14 2009
@@ -29,7 +29,8 @@
/// block.
llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(const llvm::Type *Ty,
const char *Name) {
- // FIXME: Should not pass name if names are disabled in IRBuilder.
+ if (!Builder.isNamePreserving())
+ Name = "";
return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=67459&r1=67458&r2=67459&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sat Mar 21 19:24:14 2009
@@ -163,9 +163,11 @@
// later. Don't create this with the builder, because we don't want it
// folded.
llvm::Value *Undef = llvm::UndefValue::get(llvm::Type::Int32Ty);
- AllocaInsertPt = new llvm::BitCastInst(Undef, llvm::Type::Int32Ty, "allocapt",
+ AllocaInsertPt = new llvm::BitCastInst(Undef, llvm::Type::Int32Ty, "",
EntryBB);
-
+ if (Builder.isNamePreserving())
+ AllocaInsertPt->setName("allocapt");
+
ReturnBlock = createBasicBlock("return");
ReturnValue = 0;
if (!RetTy->isVoidType())
More information about the cfe-commits
mailing list