Be more mathematicly precise about definition of recurrence [NFC]
authorPhilip Reames <listmail@philipreames.com>
Fri, 26 Feb 2021 19:17:47 +0000 (11:17 -0800)
committerPhilip Reames <listmail@philipreames.com>
Fri, 26 Feb 2021 19:22:01 +0000 (11:22 -0800)
commitf2cfef35966a24265b9e3c1b5ef8e64dcd5f431a
treecf9219bf812bbd1a8b9fd73c6ff2d00bdc040b52
parentbed888242662c2327b32b91a03635e079ad5667e
Be more mathematicly precise about definition of recurrence [NFC]

This clarifies the interface of the matchSimpleRecurrence helper introduced in 8020be0b8 for non-commutative operators.  After ebd3aeba, I realized the original way I framed the routine was inconsistent.  For shifts, we only matched the the LHS form, but for sub we matched both and the caller wanted that information.  So, instead, we now consistently match both forms for non-commutative operators and the caller becomes responsible for filtering if needed.  I tried to put a clear warning in the header because I suspect the RHS form of e.g. a sub recurrence is non-obvious for most folks.  (It was for me.)
llvm/include/llvm/Analysis/ValueTracking.h
llvm/lib/Analysis/ValueTracking.cpp