summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LICM.cpp
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
commit4056a73638d3019cbd153679361411d5595f50c9 (patch)
tree2e468da0a3b3f7e2faa3007233382f62101d7333 /lib/Transforms/Scalar/LICM.cpp
parent973f72a29aeafb1fdc4f8dafc3f6c6651cbb0c99 (diff)
downloadexternal_llvm-4056a73638d3019cbd153679361411d5595f50c9.zip
external_llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.gz
external_llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.bz2
An instruction in a loop is not guaranteed to be executed just because the loop
has no exit blocks. Fixes PR12706! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LICM.cpp')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 8795cd8..582948e 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/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;
}