diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-05-01 04:03:01 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-05-01 04:03:01 +0000 |
commit | 78ee67e8149399d04d34c16c86f0a7786fa4bc49 (patch) | |
tree | 42706ff53ed0eff37f1cb40155091c63b978d6b3 /llvm/lib/Transforms | |
parent | dabed2229c96f7da3ca68b910c5095743065520f (diff) | |
download | bcm5719-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.cpp | 5 |
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; } |