[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LCSSA.cpp
Owen Anderson
resistor at mac.com
Mon Jun 5 21:28:42 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
LCSSA.cpp updated: 1.13 -> 1.14
---
Log message:
Stop a memory leak, and update some comments.
---
Diffs of the changes: (+10 -10)
LCSSA.cpp | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
Index: llvm/lib/Transforms/Scalar/LCSSA.cpp
diff -u llvm/lib/Transforms/Scalar/LCSSA.cpp:1.13 llvm/lib/Transforms/Scalar/LCSSA.cpp:1.14
--- llvm/lib/Transforms/Scalar/LCSSA.cpp:1.13 Sat Jun 3 19:55:19 2006
+++ llvm/lib/Transforms/Scalar/LCSSA.cpp Mon Jun 5 23:28:30 2006
@@ -52,7 +52,7 @@
LoopInfo *LI; // Loop information
DominatorTree *DT; // Dominator Tree for the current Function...
DominanceFrontier *DF; // Current Dominance Frontier
- std::vector<BasicBlock*> *LoopBlocks;
+ std::vector<BasicBlock*> LoopBlocks;
virtual bool runOnFunction(Function &F);
bool visitSubloop(Loop* L);
@@ -76,8 +76,9 @@
Instruction *getValueDominatingBlock(BasicBlock *BB,
std::map<BasicBlock*, Instruction*>& PotDoms);
- bool inLoopBlocks(BasicBlock* B) { return std::binary_search(
- LoopBlocks->begin(), LoopBlocks->end(), B); }
+ /// inLoop - returns true if the given block is within the current loop
+ const bool inLoop(BasicBlock* B) {
+ return std::binary_search(LoopBlocks.begin(), LoopBlocks.end(), B); }
};
RegisterOpt<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
@@ -90,7 +91,6 @@
LI = &getAnalysis<LoopInfo>();
DF = &getAnalysis<DominanceFrontier>();
DT = &getAnalysis<DominatorTree>();
- LoopBlocks = new std::vector<BasicBlock*>;
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
changed |= visitSubloop(*I);
@@ -104,9 +104,9 @@
visitSubloop(*I);
// Speed up queries by creating a sorted list of blocks
- LoopBlocks->clear();
- LoopBlocks->insert(LoopBlocks->end(), L->block_begin(), L->block_end());
- std::sort(LoopBlocks->begin(), LoopBlocks->end());
+ LoopBlocks.clear();
+ LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
+ std::sort(LoopBlocks.begin(), LoopBlocks.end());
SetVector<Instruction*> AffectedValues = getLoopValuesUsedOutsideLoop(L);
@@ -127,7 +127,7 @@
processInstruction(*I, exitBlocks);
}
- return true; // FIXME: Should be more intelligent in our return value.
+ return true;
}
/// processInstruction -
@@ -205,7 +205,7 @@
UI != UE; ++UI) {
Instruction* use = cast<Instruction>(*UI);
// Don't need to update uses within the loop body.
- if (!inLoopBlocks(use->getParent()))
+ if (!inLoop(use->getParent()))
Uses.push_back(use);
}
@@ -242,7 +242,7 @@
for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
++UI) {
BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
- if (!std::binary_search(LoopBlocks->begin(), LoopBlocks->end(), UserBB))
+ if (!std::binary_search(LoopBlocks.begin(), LoopBlocks.end(), UserBB))
{
AffectedValues.insert(I);
break;
More information about the llvm-commits
mailing list