|
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4 |
|
| #
a1058776 |
| 21-Aug-2024 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Remove some of the complexity-based canonicalization (#91185)
The idea behind this canonicalization is that it allows us to handle less
patterns, because we know that some will be can
[InstCombine] Remove some of the complexity-based canonicalization (#91185)
The idea behind this canonicalization is that it allows us to handle less
patterns, because we know that some will be canonicalized away. This is
indeed very useful to e.g. know that constants are always on the right.
However, this is only useful if the canonicalization is actually
reliable. This is the case for constants, but not for arguments: Moving
these to the right makes it look like the "more complex" expression is
guaranteed to be on the left, but this is not actually the case in
practice. It fails as soon as you replace the argument with another
instruction.
The end result is that it looks like things correctly work in tests,
while they actually don't. We use the "thwart complexity-based
canonicalization" trick to handle this in tests, but it's often a
challenge for new contributors to get this right, and based on the
regressions this PR originally exposed, we clearly don't get this right
in many cases.
For this reason, I think that it's better to remove this complexity
canonicalization. It will make it much easier to write tests for
commuted cases and make sure that they are handled.
show more ...
|
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7 |
|
| #
c3c443bb |
| 04-Jun-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Add transforms `(icmp spred (and X, Y), X)` if `X` or `Y` are known signed/unsigned
Several transforms: 1) If known `Y < 0`: - slt -> ult: https://alive2.llvm.org/ce/z/9zt2
[InstCombine] Add transforms `(icmp spred (and X, Y), X)` if `X` or `Y` are known signed/unsigned
Several transforms: 1) If known `Y < 0`: - slt -> ult: https://alive2.llvm.org/ce/z/9zt2iK - sle -> ule: https://alive2.llvm.org/ce/z/SPoPNF - sgt -> ugt: https://alive2.llvm.org/ce/z/IGNxAk - sge -> uge: https://alive2.llvm.org/ce/z/joqTvR 2) If known `Y >= 0`: - `(X & PosY) s> X --> X s< 0` - https://alive2.llvm.org/ce/z/7e-5BQ - `(X & PosY) s> X --> X s< 0` - https://alive2.llvm.org/ce/z/jvT4Gb 3) If known `X < 0`: - `(NegX & Y) s> NegX --> Y s>= 0` - https://alive2.llvm.org/ce/z/ApkaEh - `(NegX & Y) s<= NegX --> Y s< 0` - https://alive2.llvm.org/ce/z/oRnfHp
Closes #94417
show more ...
|
|
Revision tags: llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0 |
|
| #
5532ab17 |
| 13-Sep-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Make the `(icmp eq/ne (and X, Y), X)` canonicalization work for non-const operands
We currently do: `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (and ~X, Y), 0)` if `X` is constant
[InstCombine] Make the `(icmp eq/ne (and X, Y), X)` canonicalization work for non-const operands
We currently do: `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (and ~X, Y), 0)` if `X` is constant. We can make this more general and do it if `X` is freely invertable (i.e say `X = ~Z`).
As well, we can also do: `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (or X, ~Y), -1)` If `Y` is freely invertible.
Proofs: https://alive2.llvm.org/ce/z/yeWH3E
Differential Revision: https://reviews.llvm.org/D159059
Closes #84688
show more ...
|
| #
b60cf84e |
| 13-Mar-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Add more cases for simplifying `(icmp (and/or x, Mask), y)`
This cleans up basically all the regressions assosiated from #84688
Proof of all new cases: https://alive2.llvm.org/ce/z/5y
[InstCombine] Add more cases for simplifying `(icmp (and/or x, Mask), y)`
This cleans up basically all the regressions assosiated from #84688
Proof of all new cases: https://alive2.llvm.org/ce/z/5yYWLb
Closes #85445
show more ...
|
| #
23047dfb |
| 13-Mar-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Add more tests for simplifying `(icmp (and/or x, Mask), y)`; NFC
|
| #
cf5cd98e |
| 15-Mar-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[InstCombine] Support and/or in `getFreelyInvertedImpl` using DeMorgan's Law (#85193)
This patch adds the support for and/or in `getFreelyInvertedImpl` using
DeMorgan's Law:
```
(~(A | B)) -> (~A
[InstCombine] Support and/or in `getFreelyInvertedImpl` using DeMorgan's Law (#85193)
This patch adds the support for and/or in `getFreelyInvertedImpl` using
DeMorgan's Law:
```
(~(A | B)) -> (~A & ~B)
(~(A & B)) -> (~A | ~B)
```
Alive2: https://alive2.llvm.org/ce/z/Uig8-j
show more ...
|
| #
5ca325e4 |
| 12-Mar-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Detect `(x ^ -x)` as a ~Mask
Proof: https://alive2.llvm.org/ce/z/TAFmPw
This is a lemma for clearing up some of the regressions that #84688 causes.
Closes #84868
|
| #
377da515 |
| 12-Mar-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Add test for detecting `(x ^ -x)` as a ~Mask; NFC
|
| #
193b3d67 |
| 13-Sep-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Recognize `(icmp eq/ne (and X, ~Mask), 0)` pattern in `foldICmpWithLowBitMaskedVal`
`(icmp eq/ne (and X, ~Mask), 0)` is equivilent to `(icmp eq/ne (and X, Mask), X` and we sometimes ge
[InstCombine] Recognize `(icmp eq/ne (and X, ~Mask), 0)` pattern in `foldICmpWithLowBitMaskedVal`
`(icmp eq/ne (and X, ~Mask), 0)` is equivilent to `(icmp eq/ne (and X, Mask), X` and we sometimes generate the former pattern intentionally to reduce number of uses of `X`. Proof: https://alive2.llvm.org/ce/z/3u-usC
Differential Revision: https://reviews.llvm.org/D159329
Closes #81562
show more ...
|
| #
d77eb9ea |
| 13-Sep-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Improve mask detection in `foldICmpWithLowBitMaskedVal`
Make recursive matcher that is able to detect a lot more patterns. Proofs for all supported patterns: https://alive2.llvm.org/ce
[InstCombine] Improve mask detection in `foldICmpWithLowBitMaskedVal`
Make recursive matcher that is able to detect a lot more patterns. Proofs for all supported patterns: https://alive2.llvm.org/ce/z/fSQ3nZ
Differential Revision: https://reviews.llvm.org/D159058
show more ...
|
| #
e3444ad0 |
| 13-Sep-2023 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[InstCombine] Add tests for expanding `foldICmpWithLowBitMaskedVal`; NFC
Differential Revision: https://reviews.llvm.org/D159057
|