Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6
# f4f6566e 08-Dec-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[InstCombine] Fix type mismatch in `foldICmpBinOpEqualityWithConstant` (#119068)

Closes https://github.com/llvm/llvm-project/issues/119063.


Revision tags: 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, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4
# b4ac7f4f 09-Apr-2024 Noah Goldstein <goldstein.w.n@gmail.com>

[InstCombine] Fold `(icmp eq/ne (or (select cond, 0/NZ, 0/NZ), X), 0)`

Four cases:
`(icmp eq (or (select cond, 0, NonZero), Other))`
-> `(and cond, (icmp eq Other, 0))`
`(icmp ne (or (select cond,

[InstCombine] Fold `(icmp eq/ne (or (select cond, 0/NZ, 0/NZ), X), 0)`

Four cases:
`(icmp eq (or (select cond, 0, NonZero), Other))`
-> `(and cond, (icmp eq Other, 0))`
`(icmp ne (or (select cond, NonZero, 0), Other))`
-> `(or cond, (icmp ne Other, 0))`
`(icmp ne (or (select cond, 0, NonZero), Other))`
-> `(or (not cond), (icmp ne Other, 0))`
`(icmp eq (or (select cond, NonZero, 0), Other))`
-> `(and (not cond), (icmp eq Other, 0))`

These cases came up in tests on: #88088

Proofs: https://alive2.llvm.org/ce/z/ojGo_J

Closes #88183

show more ...


# 8fda5ba0 09-Apr-2024 Noah Goldstein <goldstein.w.n@gmail.com>

[InstCombine] Add tests for folding `(icmp eq/ne (or (select cond, 0/NZ, 0/NZ), X), 0)`; NFC