diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2025-10-11 10:04:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-11 10:04:55 +0800 |
commit | 9e63b7ae4c6f6a06882ade921795c42108355c71 (patch) | |
tree | f75257b7c6de785632960c97b2527a94dd973382 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 4cc0bae159e56dc02145f9154005dc1eb9ed1fd7 (diff) | |
download | llvm-9e63b7ae4c6f6a06882ade921795c42108355c71.zip llvm-9e63b7ae4c6f6a06882ade921795c42108355c71.tar.gz llvm-9e63b7ae4c6f6a06882ade921795c42108355c71.tar.bz2 |
[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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions