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

Devang Patel dpatel at apple.com
Tue Mar 20 13:18:34 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.79 -> 1.80
---
Log message:

LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.


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

 LoopSimplify.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.79 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.80
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.79	Tue Dec 19 16:17:40 2006
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp	Tue Mar 20 15:18:12 2007
@@ -66,6 +66,7 @@
       AU.addRequired<LoopInfo>();
       AU.addRequired<DominatorSet>();
       AU.addRequired<DominatorTree>();
+      AU.addRequired<ETForest>();
 
       AU.addPreserved<LoopInfo>();
       AU.addPreserved<DominatorSet>();
@@ -417,13 +418,13 @@
 
 /// FindPHIToPartitionLoops - The first part of loop-nestification is to find a
 /// PHI node that tells us how to partition the loops.
-static PHINode *FindPHIToPartitionLoops(Loop *L, DominatorSet &DS,
-                                        AliasAnalysis *AA) {
+static PHINode *FindPHIToPartitionLoops(Loop *L, ETForest *EF, 
+					AliasAnalysis *AA) {
   for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ) {
     PHINode *PN = cast<PHINode>(I);
     ++I;
     if (Value *V = PN->hasConstantValue())
-      if (!isa<Instruction>(V) || DS.dominates(cast<Instruction>(V), PN)) {
+      if (!isa<Instruction>(V) || EF->dominates(cast<Instruction>(V), PN)) {
         // This is a degenerate PHI already, don't modify it!
         PN->replaceAllUsesWith(V);
         if (AA) AA->deleteValue(PN);
@@ -497,7 +498,8 @@
 /// created.
 ///
 Loop *LoopSimplify::SeparateNestedLoop(Loop *L) {
-  PHINode *PN = FindPHIToPartitionLoops(L, getAnalysis<DominatorSet>(), AA);
+  ETForest *EF = getAnalysisToUpdate<ETForest>();
+  PHINode *PN = FindPHIToPartitionLoops(L, EF, AA);
   if (PN == 0) return 0;  // No known way to partition.
 
   // Pull out all predecessors that have varying values in the loop.  This






More information about the llvm-commits mailing list