diff options
author | Sanjay Patel <spatel@rotateright.com> | 2021-05-03 15:07:10 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2021-05-03 15:57:40 -0400 |
commit | 15a42339fe5f5daa86651e181df9a4f89d3ededf (patch) | |
tree | 748a6148fac4f3ef28939e456c46a2b390a67630 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | fd15e2b825f26dd7eac3b4a52aab36c88e52850a (diff) | |
download | llvm-15a42339fe5f5daa86651e181df9a4f89d3ededf.zip llvm-15a42339fe5f5daa86651e181df9a4f89d3ededf.tar.gz llvm-15a42339fe5f5daa86651e181df9a4f89d3ededf.tar.bz2 |
[ValueTracking] soften assert for invertible recurrence matching
There's a TODO comment in the code and discussion in D99912
about generalizing this, but I wasn't sure how to implement that,
so just going with a potential minimal fix to avoid crashing.
The test is a reduction beyond useful code (there's no user of
%user...), but it is based on https://llvm.org/PR50191, so this
is asserting on real code.
Differential Revision: https://reviews.llvm.org/D101772
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index f8daf6a..30c64f1 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2608,7 +2608,8 @@ static Optional<unsigned> getInvertibleOperand(const Operator *Op1, cast<Operator>(BO2)); if (!Idx || *Idx != 0) break; - assert(BO1->getOperand(*Idx) == PN1 && BO2->getOperand(*Idx) == PN2); + if (BO1->getOperand(*Idx) != PN1 || BO2->getOperand(*Idx) != PN2) + break; // Phi operands might not be in the same order. TODO: generalize // interface to return pair of operands. |