summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-07-20 23:33:06 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-07-20 23:33:06 +0000
commitc5b8b590ee43d05816bf94ae54c77cb6275b98e4 (patch)
tree363fe0f8e5fe732ff451fdea5803ad9cc0dee90b /lib/Transforms
parentaff50164ebf602c4ae63a14337adbc30fbb86280 (diff)
downloadllvm-c5b8b590ee43d05816bf94ae54c77cb6275b98e4.tar.gz
llvm-c5b8b590ee43d05816bf94ae54c77cb6275b98e4.tar.bz2
llvm-c5b8b590ee43d05816bf94ae54c77cb6275b98e4.tar.xz
Don't allocate the DIBuilder on the heap and remove all the complexity
that ensued from that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index ef1b55a348..bb215cd144 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -178,7 +178,7 @@ struct PromoteMem2Reg {
/// The alloca instructions being promoted.
std::vector<AllocaInst *> Allocas;
DominatorTree &DT;
- DIBuilder *DIB;
+ DIBuilder DIB;
/// An AliasSetTracker object to update. If null, don't update it.
AliasSetTracker *AST;
@@ -225,8 +225,8 @@ struct PromoteMem2Reg {
public:
PromoteMem2Reg(const std::vector<AllocaInst *> &Allocas, DominatorTree &DT,
AliasSetTracker *AST)
- : Allocas(Allocas), DT(DT), DIB(0), AST(AST) {}
- ~PromoteMem2Reg() { delete DIB; }
+ : Allocas(Allocas), DT(DT), DIB(*DT.getRoot()->getParent()->getParent()),
+ AST(AST) {}
void run();
@@ -405,9 +405,7 @@ void PromoteMem2Reg::run() {
// Record debuginfo for the store and remove the declaration's
// debuginfo.
if (DbgDeclareInst *DDI = Info.DbgDeclare) {
- if (!DIB)
- DIB = new DIBuilder(*DDI->getParent()->getParent()->getParent());
- ConvertDebugDeclareToDebugValue(DDI, Info.OnlyStore, *DIB);
+ ConvertDebugDeclareToDebugValue(DDI, Info.OnlyStore, DIB);
DDI->eraseFromParent();
}
// Remove the (now dead) store and alloca.
@@ -440,11 +438,8 @@ void PromoteMem2Reg::run() {
while (!AI->use_empty()) {
StoreInst *SI = cast<StoreInst>(AI->use_back());
// Record debuginfo for the store before removing it.
- if (DbgDeclareInst *DDI = Info.DbgDeclare) {
- if (!DIB)
- DIB = new DIBuilder(*SI->getParent()->getParent()->getParent());
- ConvertDebugDeclareToDebugValue(DDI, SI, *DIB);
- }
+ if (DbgDeclareInst *DDI = Info.DbgDeclare)
+ ConvertDebugDeclareToDebugValue(DDI, SI, DIB);
SI->eraseFromParent();
LBI.deleteValue(SI);
}
@@ -1089,11 +1084,8 @@ NextIteration:
// what value were we writing?
IncomingVals[ai->second] = SI->getOperand(0);
// Record debuginfo for the store before removing it.
- if (DbgDeclareInst *DDI = AllocaDbgDeclares[ai->second]) {
- if (!DIB)
- DIB = new DIBuilder(*SI->getParent()->getParent()->getParent());
- ConvertDebugDeclareToDebugValue(DDI, SI, *DIB);
- }
+ if (DbgDeclareInst *DDI = AllocaDbgDeclares[ai->second])
+ ConvertDebugDeclareToDebugValue(DDI, SI, DIB);
BB->getInstList().erase(SI);
}
}