[llvm] [InstSimplify] Forbid undef folds in foldOrCommuteConstant when undef cannot be used. (PR #170670)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 6 06:18:45 PST 2025
================
----------------
dianqk wrote:
I managed to reduce a bit.
`%i8` can be folded to -1, so `%arg1` can be folded to undef.
First, we try to expand `%i13 = and i8 %i9, %i12` to `%i13 = L1(%arg1(undef) and %i12) or (-1 and %i12)`.
Then, we try to expand `L1(%arg1(undef) and %i12)` to `(%arg1(undef) and %i7) xor (%arg1(undef) and -1)`.
For `%arg1(undef) and %i7`, `%arg1(undef)` is folded to 0, whereas for `%arg1(undef) and -1`, it is folded to undef.
https://github.com/llvm/llvm-project/pull/170670
More information about the llvm-commits
mailing list