6 Commits

Author SHA1 Message Date
chenglin.bi
b4c8cfc7c2 [InstCombine] fold more icmp + select patterns by distributive laws
follow up D139076, add icmp with not only eq/ne, but also gt/lt/ge/le.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D139253
2022-12-07 23:55:49 +08:00
chenglin.bi
b966fb08a2 [InstCombine] Precommit tests for D139253; NFC 2022-12-06 00:00:54 +08:00
chenglin.bi
e719550e6f [InstCombine] fold icmp + select pattern by distributive laws
`C ? (Y != X) : (Z != X) --> (C ? Y : Z) != X`
`C ? (Y == X) : (Z == X) --> (C ? Y : Z) == X`

https://alive2.llvm.org/ce/z/-frXfs

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D139076
2022-12-03 07:56:19 +08:00
chenglin.bi
6a70b846a4 [InstCombine] Precommit tests for D139076; NFC 2022-12-03 02:01:57 +08:00
Juneyoung Lee
40a2e35599 [InstCombine] Remove the undef-related workaround code in visitSelectInst
This patch removes an old hack in visitSelectInst that was written to avoid miscompilation bugs in loop unswitch.
(Added via https://reviews.llvm.org/D35811)

The legacy loop unswitch pass will be removed after D124376, and the new simple loop unswitch pass correctly uses freeze to avoid introducing UB after D124252.

Since the hack is not necessary anymore, this patch removes it.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D124426
2022-04-30 20:48:42 +09:00
Juneyoung Lee
112e3d8687 Add a pre-commit test for D124426 2022-04-30 20:41:28 +09:00