[llvm-commits] [llvm] r55806 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp

Devang Patel dpatel at apple.com
Thu Sep 4 15:44:00 PDT 2008


Author: dpatel
Date: Thu Sep  4 17:43:59 2008
New Revision: 55806

URL: http://llvm.org/viewvc/llvm-project?rev=55806&view=rev
Log:
A loop may be unswitched multiple times. Reconstruct dom info. at the end.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=55806&r1=55805&r2=55806&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Sep  4 17:43:59 2008
@@ -190,6 +190,7 @@
   DF = getAnalysisToUpdate<DominanceFrontier>();
   DT = getAnalysisToUpdate<DominatorTree>();
   currentLoop = L;
+  Function *F = currentLoop->getHeader()->getParent();
   bool Changed = false;
   do {
     assert(currentLoop->isLCSSAForm());
@@ -197,6 +198,13 @@
     Changed |= processCurrentLoop();
   } while(redoLoop);
 
+  if (Changed) {
+    // FIXME: Reconstruct dom info, because it is not preserved properly.
+    if (DT)
+      DT->runOnFunction(*F);
+    if (DF)
+      DF->runOnFunction(*F);
+  }
   return Changed;
 }
 
@@ -450,11 +458,6 @@
     UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
   }
 
-  // FIXME: Reconstruct dom info, because it is not preserved properly.
-  if (DT)
-    DT->runOnFunction(*F);
-  if (DF)
-    DF->runOnFunction(*F);
   return true;
 }
 





More information about the llvm-commits mailing list