aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LICM.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2009-12-10 00:25:41 +0000
committerEric Christopher <echristo@apple.com>2009-12-10 00:25:41 +0000
commit3472ae1e7b0f38c4ac0802ffc2900f71a5470c3b (patch)
treeaf13bebcd0a19b3327f12c642cbe13792ec07c06 /lib/Transforms/Scalar/LICM.cpp
parent16f244e9822ffca7818d202df90cd2049f5b6cf6 (diff)
downloadexternal_llvm-3472ae1e7b0f38c4ac0802ffc2900f71a5470c3b.zip
external_llvm-3472ae1e7b0f38c4ac0802ffc2900f71a5470c3b.tar.gz
external_llvm-3472ae1e7b0f38c4ac0802ffc2900f71a5470c3b.tar.bz2
Make sure the immediate dominator isn't NULL through iterations
of the loop. We could get to this condition via indirect branches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LICM.cpp')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 5511387..42a8fdc 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -160,16 +160,17 @@ namespace {
// 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;
}