diff options
author | Roman Shirokiy <shirokiyroman@yandex.ru> | 2018-06-29 11:46:30 +0000 |
---|---|---|
committer | Roman Shirokiy <shirokiyroman@yandex.ru> | 2018-06-29 11:46:30 +0000 |
commit | 272eac85c7886708becec8510c1c350ab3024704 (patch) | |
tree | 0ff85ddb7153d0128ecdfff9f81cf8f8e20eeb83 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 9bd44390b4e35a60789b5e10a64d8f38b908f181 (diff) | |
download | bcm5719-llvm-272eac85c7886708becec8510c1c350ab3024704.tar.gz bcm5719-llvm-272eac85c7886708becec8510c1c350ab3024704.zip |
Fix overconfident assert in ScalarEvolution::isImpliedViaMerge
We can have AddRec with loops having many predecessors.
This changes an assert to an early return.
Differential Revision: https://reviews.llvm.org/D48766
llvm-svn: 335965
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index fce2a0e905f..d52c5b0276a 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -9712,8 +9712,9 @@ bool ScalarEvolution::isImpliedViaMerge(ICmpInst::Predicate Pred, // AddRec. It means that there is a loop which has both AddRec and Unknown // PHIs, for it we can compare incoming values of AddRec from above the loop // and latch with their respective incoming values of LPhi. - assert(LPhi->getNumIncomingValues() == 2 && - "Phi node standing in loop header does not have exactly 2 inputs?"); + // TODO: Generalize to handle loops with many inputs in a header. + if (LPhi->getNumIncomingValues() != 2) return false; + auto *RLoop = RAR->getLoop(); auto *Predecessor = RLoop->getLoopPredecessor(); assert(Predecessor && "Loop with AddRec with no predecessor?"); |