[SCEV] `createNodeForSelectOrPHIInstWithICmpInstCond()`: generalize eq handling
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 11 Feb 2022 12:48:36 +0000 (15:48 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 11 Feb 2022 18:58:19 +0000 (21:58 +0300)
commit4d0c0e6cc250e0637548f8a8519a95f15b6fab2e
tree4d417fbb2c116258d48db96f243293273148ac28
parenta473c457f6aa7a5d734aef5a325eae30dd9e22e0
[SCEV] `createNodeForSelectOrPHIInstWithICmpInstCond()`: generalize eq handling

The current logic was: https://alive2.llvm.org/ce/z/j8muXk
but in reality the offset to the Y in the 'true' hand
does not need to exist: https://alive2.llvm.org/ce/z/MNQ7DZ
https://alive2.llvm.org/ce/z/S2pMQD

To catch that, instead of computing the Y's in both
hands and checking their equality, compute Y and C,
and check that C is 0 or 1.
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/logical-operations.ll
llvm/test/Analysis/ScalarEvolution/min-max-exprs.ll
polly/test/ForwardOpTree/changed-kind.ll