llvm-project
9e63b7ae - [InstCombine] Fix flag propagation in `foldSelectIntoOp` (#162003)

Commit
137 days ago
[InstCombine] Fix flag propagation in `foldSelectIntoOp` (#162003) Consider the following transform: ``` C = binop float A, nnan OOp D = select ninf, i1 cond, float C, float A -> E = select ninf, i1 cond, float OOp, float Identity F = binop float A, E ``` We cannot propagate ninf from the original select, because OOp may be inf, and the flag only guarantees that FalseVal (op OOp) is never infinity. Examples: -inf + +inf = NaN, -inf - -inf = NaN, 0 * inf = NaN Specifically, if the original select has both ninf and nnan, we can safely propagate the flag. Alive2: + fadd: https://alive2.llvm.org/ce/z/TWfktv + fsub: https://alive2.llvm.org/ce/z/RAsjJb + fmul: https://alive2.llvm.org/ce/z/8eg4ND Closes https://github.com/llvm/llvm-project/issues/161634.
Author
Parents
Loading