Skip to content
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

Transform that breaks sign of infinity incorrectly accepted #855

Closed
arsenm opened this issue Oct 17, 2022 · 1 comment
Closed

Transform that breaks sign of infinity incorrectly accepted #855

arsenm opened this issue Oct 17, 2022 · 1 comment

Comments

@arsenm
Copy link
Contributor

arsenm commented Oct 17, 2022

Transforming fdiv nnan nsz x, 0 -> +inf is incorrectly reported as correct. The sign of the result should match the sign of the numerator, so fdiv nnan nsz -inf, 0 should be -inf

https://alive2.llvm.org/ce/z/P2ucrd
https://reviews.llvm.org/D136097

define float @src(float %x) {
  %fdiv = fdiv nnan nsz float %x, 0.0
  ret float %fdiv
}


define float @tgt(float %x) {
  ret float 0x7FF0000000000000
}

=>
define float @tgt(float %x) denormal-fp-math=ieee,ieee {
%0:
  ret float inf
}
Transformation seems to be correct!
@nunoplopes
Copy link
Member

Alive2 is correct. I've left a comment in the LLVM patch.
nsw applies to both inputs and outputs of instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants