[llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp

Chris Lattner sabre at nondot.org
Sat Apr 14 15:10:39 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

LCSSA.cpp updated: 1.35 -> 1.36
---
Log message:

avoid copying sets and vectors around.


---
Diffs of the changes:  (+6 -7)

 LCSSA.cpp |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/Utils/LCSSA.cpp
diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.35 llvm/lib/Transforms/Utils/LCSSA.cpp:1.36
--- llvm/lib/Transforms/Utils/LCSSA.cpp:1.35	Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Utils/LCSSA.cpp	Sat Apr 14 17:10:17 2007
@@ -69,7 +69,8 @@
       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 @@
   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 @@
 
 /// 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 @@
         }
       }
   }
-  return AffectedValues;
 }
 
 /// GetValueForBlock - Get the value to use within the specified basic block.






More information about the llvm-commits mailing list