[all-commits] [llvm/llvm-project] edb070: [InstCombine] Implement `fcmp (fadd x, 0.0), y` =>...

Vlad Mishel via All-commits all-commits at lists.llvm.org
Mon Apr 15 22:05:52 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: edb0708dc1ceeaeb3356311a4ddf72a0dc9b224f
      https://github.com/llvm/llvm-project/commit/edb0708dc1ceeaeb3356311a4ddf72a0dc9b224f
  Author: Vlad Mishel <43666597+vmishelcs at users.noreply.github.com>
  Date:   2024-04-16 (Tue, 16 Apr 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/fcmp.ll

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



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