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

Devang Patel dpatel at apple.com
Wed Jul 2 23:48:22 PDT 2008


Author: dpatel
Date: Thu Jul  3 01:48:21 2008
New Revision: 53086

URL: http://llvm.org/viewvc/llvm-project?rev=53086&view=rev
Log:
Reconstruct dom info, if loop is unswitched.

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=53086&r1=53085&r2=53086&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul  3 01:48:21 2008
@@ -113,8 +113,8 @@
       AU.addRequiredID(LCSSAID);
       AU.addPreservedID(LCSSAID);
       // FIXME: Loop Unswitch does not preserve dominator info in all cases.
-      // AU.addPreserved<DominatorTree>();
-      // AU.addPreserved<DominanceFrontier>();
+      AU.addPreserved<DominatorTree>();
+      AU.addPreserved<DominanceFrontier>();
     }
 
   private:
@@ -206,7 +206,6 @@
   DT = getAnalysisToUpdate<DominatorTree>();
   currentLoop = L;
   bool Changed = false;
-
   do {
     assert(currentLoop->isLCSSAForm());
     redoLoop = false;
@@ -459,7 +458,13 @@
   } else {
     UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
   }
- 
+
+  // FIXME: Reconstruct dom info, because it is not preserved properly.
+  Function *F = loopHeader->getParent();
+  if (DT)
+    DT->runOnFunction(*F);
+  if (DF)
+    DF->runOnFunction(*F);
   return true;
 }
 





More information about the llvm-commits mailing list