Skip to content

Missing FP optimization opportunities for fcmp ord operations #49175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aqjune opened this issue Apr 4, 2021 · 1 comment
Open

Missing FP optimization opportunities for fcmp ord operations #49175

aqjune opened this issue Apr 4, 2021 · 1 comment
Labels
bugzilla Issues migrated from bugzilla floating-point Floating-point math llvm:optimizations missed-optimization

Comments

@aqjune
Copy link
Contributor

aqjune commented Apr 4, 2021

Bugzilla Link 49831
Version trunk
OS All
Blocks #49274
CC @RKSimon,@rotateright

Extended Description

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

define i1 @_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

@RKSimon
Copy link
Collaborator

RKSimon commented Nov 27, 2021

mentioned in issue #49274

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla floating-point Floating-point math llvm:optimizations missed-optimization
Projects
None yet
Development

No branches or pull requests

4 participants