FYLGQ 764457a6e9
[InstCombine] Fold cmp of select-of-constants via truth table (#186591)
This patch adds a generic InstCombine fold for:
cmp pred (select C1, TV1, FV1), (select C2, TV2, FV2)
when all select arms are constants and the comparison can be
constant-folded for all four combinations of C1/C2. The fold computes a
4-entry truth table and synthesizes a boolean expression using
createLogicFromTable.
This generalizes patterns like:
fcmp une (select C1, -1.0, 1.0), (select C2, -1.0, 1.0) -> xor C1, C2
The transform bails out for mixed vector results like:
<i1 true, i1 false>

alive2: https://alive2.llvm.org/ce/z/JQ_Poy

Fixes #186558
2026-03-30 14:19:05 +02:00
..