[llvm-commits] [llvm] r91009 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Eric Christopher echristo at apple.com
Wed Dec 9 16:25:41 PST 2009


Author: echristo
Date: Wed Dec  9 18:25:41 2009
New Revision: 91009

URL: http://llvm.org/viewvc/llvm-project?rev=91009&view=rev
Log:
Make sure the immediate dominator isn't NULL through iterations
of the loop. We could get to this condition via indirect
branches.

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Dec  9 18:25:41 2009
@@ -160,16 +160,17 @@
 
       // Because the exit block is not in the loop, we know we have to get _at
       // least_ its immediate dominator.
-      do {
-        // Get next Immediate Dominator.
-        IDom = IDom->getIDom();
-
+      IDom = IDom->getIDom();
+      
+      while (IDom && IDom != BlockInLoopNode) {
         // If we have got to the header of the loop, then the instructions block
         // did not dominate the exit node, so we can't hoist it.
         if (IDom->getBlock() == LoopHeader)
           return false;
 
-      } while (IDom != BlockInLoopNode);
+        // Get next Immediate Dominator.
+        IDom = IDom->getIDom();
+      };
 
       return true;
     }





More information about the llvm-commits mailing list