[all-commits] [llvm/llvm-project] 9e63b7: [InstCombine] Fix flag propagation in `foldSelectI...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Fri Oct 10 19:05:18 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e63b7ae4c6f6a06882ade921795c42108355c71
      https://github.com/llvm/llvm-project/commit/9e63b7ae4c6f6a06882ade921795c42108355c71
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-10-11 (Sat, 11 Oct 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll
    M llvm/test/Transforms/InstCombine/select-binop-foldable-floating-point.ll
    M llvm/test/Transforms/LoopVectorize/ARM/mve-selectandorcost.ll
    M llvm/test/Transforms/PhaseOrdering/AArch64/predicated-reduction.ll

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list