summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-05-01 04:03:01 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-05-01 04:03:01 +0000
commit78ee67e8149399d04d34c16c86f0a7786fa4bc49 (patch)
tree42706ff53ed0eff37f1cb40155091c63b978d6b3 /llvm/lib/Transforms
parentdabed2229c96f7da3ca68b910c5095743065520f (diff)
downloadbcm5719-llvm-78ee67e8149399d04d34c16c86f0a7786fa4bc49.tar.gz
bcm5719-llvm-78ee67e8149399d04d34c16c86f0a7786fa4bc49.zip
An instruction in a loop is not guaranteed to be executed just because the loop
has no exit blocks. Fixes PR12706! llvm-svn: 155884
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 8795cd853fa..582948ea14b 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -618,6 +618,11 @@ bool LICM::isGuaranteedToExecute(Instruction &Inst) {
if (!DT->dominates(Inst.getParent(), ExitBlocks[i]))
return false;
+ // As a degenerate case, if the loop is statically infinite then we haven't
+ // proven anything since there are no exit blocks.
+ if (ExitBlocks.empty())
+ return false;
+
return true;
}
OpenPOWER on IntegriCloud