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

Evan Cheng evan.cheng at apple.com
Wed May 25 11:17:13 PDT 2011


Author: evancheng
Date: Wed May 25 13:17:13 2011
New Revision: 132071

URL: http://llvm.org/viewvc/llvm-project?rev=132071&view=rev
Log:
Simplify r132022 based on Cameron's feedback.

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=132071&r1=132070&r2=132071&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed May 25 13:17:13 2011
@@ -919,18 +919,11 @@
     BasicBlock *Switch = SI->getParent();
     BasicBlock *SISucc = SI->getSuccessor(DeadCase);
     BasicBlock *Latch = L->getLoopLatch();
-    // If the DeadCase successor dominates all of the predecessors of the
-    // loop latch, then the transformation isn't safe since it will delete
-    // the predecessor edges to the latch.
-    if (Latch) {
-      bool DominateAll = true;
-      for (pred_iterator PI = pred_begin(Latch), PE = pred_end(Latch);
-           DominateAll && PI != PE; ++PI)
-        if (!DT->dominates(SISucc, *PI))
-          DominateAll = false;
-      if (DominateAll)
-        continue;
-    }
+    // If the DeadCase successor dominates the loop latch, then the
+    // transformation isn't safe since it will delete the sole predecessor edge
+    // to the latch.
+    if (Latch && DT->dominates(SISucc, Latch))
+      continue;
 
     // FIXME: This is a hack.  We need to keep the successor around
     // and hooked up so as to preserve the loop structure, because





More information about the llvm-commits mailing list