From d6b7a1648c12250c4001f2bffd2a2f61d16e59a7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 14 Apr 2007 22:10:17 +0000 Subject: avoid copying sets and vectors around. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36017 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/LCSSA.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/Transforms/Utils/LCSSA.cpp') diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index b0a8caeef9..0c223c5302 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -69,7 +69,8 @@ namespace { AU.addRequired(); } private: - SetVector getLoopValuesUsedOutsideLoop(Loop *L); + void getLoopValuesUsedOutsideLoop(Loop *L, + SetVector &AffectedValues); Value *GetValueForBlock(DominatorTree::Node *BB, Instruction *OrigInst, std::map &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 AffectedValues = getLoopValuesUsedOutsideLoop(L); + SetVector 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 LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) { - +void LCSSA::getLoopValuesUsedOutsideLoop(Loop *L, + SetVector &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 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 LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) { } } } - return AffectedValues; } /// GetValueForBlock - Get the value to use within the specified basic block. -- cgit v1.2.3