summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LCSSA.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-14 22:10:17 +0000
committerChris Lattner <sabre@nondot.org>2007-04-14 22:10:17 +0000
commita6b566020948f8d776a919c663c8abcbe5c9c231 (patch)
tree6b794dfe5f8f892f2960a6031fc7a092dbc09111 /llvm/lib/Transforms/Utils/LCSSA.cpp
parente7ce8f23f6faf126a83283de66d57fa4a3d078e2 (diff)
downloadbcm5719-llvm-a6b566020948f8d776a919c663c8abcbe5c9c231.tar.gz
bcm5719-llvm-a6b566020948f8d776a919c663c8abcbe5c9c231.zip
avoid copying sets and vectors around.
llvm-svn: 36017
Diffstat (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LCSSA.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index b0a8caeef96..0c223c53024 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -69,7 +69,8 @@ namespace {
AU.addRequired<DominatorTree>();
}
private:
- SetVector<Instruction*> getLoopValuesUsedOutsideLoop(Loop *L);
+ void getLoopValuesUsedOutsideLoop(Loop *L,
+ SetVector<Instruction*> &AffectedValues);
Value *GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst,
std::map<DominatorTree::Node*, Value*> &Phis);
@@ -110,7 +111,8 @@ bool LCSSA::visitSubloop(Loop* L) {
LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
std::sort(LoopBlocks.begin(), LoopBlocks.end());
- SetVector<Instruction*> AffectedValues = getLoopValuesUsedOutsideLoop(L);
+ SetVector<Instruction*> AffectedValues;
+ getLoopValuesUsedOutsideLoop(L, AffectedValues);
// If no values are affected, we can save a lot of work, since we know that
// nothing will be changed.
@@ -196,14 +198,12 @@ void LCSSA::ProcessInstruction(Instruction *Instr,
/// getLoopValuesUsedOutsideLoop - Return any values defined in the loop that
/// are used by instructions outside of it.
-SetVector<Instruction*> LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) {
-
+void LCSSA::getLoopValuesUsedOutsideLoop(Loop *L,
+ SetVector<Instruction*> &AffectedValues) {
// FIXME: For large loops, we may be able to avoid a lot of use-scanning
// by using dominance information. In particular, if a block does not
// dominate any of the loop exits, then none of the values defined in the
// block could be used outside the loop.
-
- SetVector<Instruction*> AffectedValues;
for (Loop::block_iterator BB = L->block_begin(), E = L->block_end();
BB != E; ++BB) {
for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ++I)
@@ -221,7 +221,6 @@ SetVector<Instruction*> LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) {
}
}
}
- return AffectedValues;
}
/// GetValueForBlock - Get the value to use within the specified basic block.
OpenPOWER on IntegriCloud