[llvm-commits] [llvm] r131956 - in /llvm/trunk: include/llvm/Transforms/Utils/SSAUpdater.h lib/Transforms/Scalar/LICM.cpp lib/Transforms/Scalar/ScalarReplAggregates.cpp lib/Transforms/Utils/SSAUpdater.cpp
Cameron Zwarich
zwarich at apple.com
Mon May 23 23:00:08 PDT 2011
Author: zwarich
Date: Tue May 24 01:00:08 2011
New Revision: 131956
URL: http://llvm.org/viewvc/llvm-project?rev=131956&view=rev
Log:
Clean up the lazy initialization of DIBuilder a bit.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h?rev=131956&r1=131955&r2=131956&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Tue May 24 01:00:08 2011
@@ -123,10 +123,10 @@
protected:
SSAUpdater &SSA;
DbgDeclareInst *DDI;
- DIBuilder *&DIB;
+ DIBuilder *DIB;
public:
LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
- SSAUpdater &S, DbgDeclareInst *DDI, DIBuilder *&DIB,
+ SSAUpdater &S, DbgDeclareInst *DDI, DIBuilder *DIB,
StringRef Name = StringRef());
virtual ~LoadAndStorePromoter() {}
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=131956&r1=131955&r2=131956&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Tue May 24 01:00:08 2011
@@ -602,13 +602,12 @@
SmallPtrSet<Value*, 4> &PointerMustAliases;
SmallVectorImpl<BasicBlock*> &LoopExitBlocks;
AliasSetTracker &AST;
- DIBuilder *DIB; // Only passed to LoadAndStorePromoter.
public:
LoopPromoter(Value *SP,
const SmallVectorImpl<Instruction*> &Insts, SSAUpdater &S,
SmallPtrSet<Value*, 4> &PMA,
SmallVectorImpl<BasicBlock*> &LEB, AliasSetTracker &ast)
- : LoadAndStorePromoter(Insts, S, 0, DIB), SomePtr(SP),
+ : LoadAndStorePromoter(Insts, S, 0, 0), SomePtr(SP),
PointerMustAliases(PMA), LoopExitBlocks(LEB), AST(ast) {}
virtual bool isInstInList(Instruction *I,
Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=131956&r1=131955&r2=131956&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue May 24 01:00:08 2011
@@ -1367,6 +1367,8 @@
Insts.push_back(cast<Instruction>(*UI));
DbgDeclareInst *DDI = FindAllocaDbgDeclare(AI);
+ if (DDI && !DIB)
+ DIB = new DIBuilder(*AI->getParent()->getParent()->getParent());
AllocaPromoter(Insts, SSA, DDI, DIB).run(AI, Insts);
Insts.clear();
}
Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=131956&r1=131955&r2=131956&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Tue May 24 01:00:08 2011
@@ -358,7 +358,7 @@
LoadAndStorePromoter::
LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
- SSAUpdater &S, DbgDeclareInst *DD, DIBuilder *&DB,
+ SSAUpdater &S, DbgDeclareInst *DD, DIBuilder *DB,
StringRef BaseName) : SSA(S), DDI(DD), DIB(DB) {
if (Insts.empty()) return;
@@ -407,11 +407,8 @@
if (BlockUses.size() == 1) {
// If it is a store, it is a trivial def of the value in the block.
if (StoreInst *SI = dyn_cast<StoreInst>(User)) {
- if (DDI) {
- if (!DIB)
- DIB = new DIBuilder(*SI->getParent()->getParent()->getParent());
+ if (DDI)
ConvertDebugDeclareToDebugValue(DDI, SI, *DIB);
- }
SSA.AddAvailableValue(BB, SI->getOperand(0));
} else
// Otherwise it is a load, queue it to rewrite as a live-in load.
@@ -466,11 +463,8 @@
// If this is a store to an unrelated pointer, ignore it.
if (!isInstInList(SI, Insts)) continue;
- if (DDI) {
- if (!DIB)
- DIB = new DIBuilder(*SI->getParent()->getParent()->getParent());
+ if (DDI)
ConvertDebugDeclareToDebugValue(DDI, SI, *DIB);
- }
// Remember that this is the active value in the block.
StoredValue = SI->getOperand(0);
More information about the llvm-commits
mailing list