[llvm] [InstCombine] avoid extra instructions in foldSelectICmpAnd (PR #127398)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 12:03:40 PST 2025
andjo403 wrote:
It is actually canonicalized the other way around see:
https://github.com/llvm/llvm-project/blob/5ecce45ea2980aff35d1283d4dd3feb8f74de16c/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L835-L865
possible to add special case there for:
(icmp eq (X & C), 0) ? (X & ~C) : (X | C) -> X
(icmp eq (X & C), 0) ? (X & ~C) : (X | C) -> X ^ C
IFF C is a power of 2.
https://alive2.llvm.org/ce/z/dD3XTi
but is it common enough that special handling is wanted?
have added a test for the regression
https://github.com/llvm/llvm-project/pull/127398
More information about the llvm-commits
mailing list