[InstCombine] Implement `fcmp (fadd x, 0.0), y` => `fcmp x, y` optimization (#88476)
This PR addresses issue #88168. It implements an optimization for
the case of
```
define i1 @fcmp_fadd_zero_ugt(float %x, float %y) {
%add = fadd float %x, 0.000000e+00
%cmp = fcmp ugt float %add, %y
ret i1 %cmp
}
```
`=>`
```
define i1 @fcmp_fadd_zero_ugt(float %x, float %y) {
%cmp = fcmp ugt float %x, %y
ret i1 %cmp
}
```
and all other types of `fcmp` instructions (`uge`, `ogt`, etc).
Proofs:
`fadd x, 0.0` https://alive2.llvm.org/ce/z/7FzNnM
`fsub x, 0.0` https://alive2.llvm.org/ce/z/puUxLK
parent
4e2d11f8
Please register or sign in to comment