diff options
author | Piotr Padlewski <prazek@google.com> | 2015-09-09 20:47:30 +0000 |
---|---|---|
committer | Piotr Padlewski <prazek@google.com> | 2015-09-09 20:47:30 +0000 |
commit | 0dde00d2399d5697e8246d534ab6cd5bfac9c038 (patch) | |
tree | 94a384ec9622882db4529cb45d68fe7ad93e7555 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 5ae4a85e3f7011e9ed89640977ac358847aa616a (diff) | |
download | bcm5719-llvm-0dde00d2399d5697e8246d534ab6cd5bfac9c038.tar.gz bcm5719-llvm-0dde00d2399d5697e8246d534ab6cd5bfac9c038.zip |
ScalarEvolution assume hanging bugfix
http://reviews.llvm.org/D12719
llvm-svn: 247184
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 37141c33009..ef695234b66 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -6958,18 +6958,6 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, LoopContinuePredicate->getSuccessor(0) != L->getHeader())) return true; - // Check conditions due to any @llvm.assume intrinsics. - for (auto &AssumeVH : AC.assumptions()) { - if (!AssumeVH) - continue; - auto *CI = cast<CallInst>(AssumeVH); - if (!DT.dominates(CI, Latch->getTerminator())) - continue; - - if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0), false)) - return true; - } - struct ClearWalkingBEDominatingCondsOnExit { ScalarEvolution &SE; @@ -6981,7 +6969,7 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, } }; - // We don't want more than one activation of the following loop on the stack + // We don't want more than one activation of the following loops on the stack // -- that can lead to O(n!) time complexity. if (WalkingBEDominatingConds) return false; @@ -6989,6 +6977,18 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, WalkingBEDominatingConds = true; ClearWalkingBEDominatingCondsOnExit ClearOnExit(*this); + // Check conditions due to any @llvm.assume intrinsics. + for (auto &AssumeVH : AC.assumptions()) { + if (!AssumeVH) + continue; + auto *CI = cast<CallInst>(AssumeVH); + if (!DT.dominates(CI, Latch->getTerminator())) + continue; + + if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0), false)) + return true; + } + // If the loop is not reachable from the entry block, we risk running into an // infinite loop as we walk up into the dom tree. These loops do not matter // anyway, so we just return a conservative answer when we see them. |