[llvm-bugs] [Bug 49831] New: Missing FP optimization opportunities for fcmp ord operations

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 3 22:33:36 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49831

            Bug ID: 49831
           Summary: Missing FP optimization opportunities for fcmp ord
                    operations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: juneyoung.lee at sf.snu.ac.kr
                CC: llvm-bugs at lists.llvm.org

; Excerpted from llvm/test/Transforms/InstCombine/and-fcmp.ll

```
$ cat src.ll
define i1 @PR41069_commute_logical(i1 %z, float %c, float %d) {
  %ord1 = fcmp ninf ord float %c, 0.0
  %and = select i1 %ord1, i1 %z, i1 false
  %ord2 = fcmp ninf reassoc ord float %d, 0.0
  %r = select i1 %ord2, i1 %and, i1 false
  ret i1 %r
}
```

This can be optimized to
```
  %c.fr = freeze float %c
  %ord1 = fcmp ord float %c.fr, %d
  %r = select i1 %ord1, i1 %z, i1 false
```

Alive2 link: https://alive2.llvm.org/ce/z/QfkJak

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210404/70a5ec5a/attachment.html>


More information about the llvm-bugs mailing list