Skip to content

[InstCombine] (fcmp une T, F) ? T : F --> T should not rely on the nsz flag on fcmp #140994

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
dtcxzyw opened this issue May 22, 2025 · 0 comments · May be fixed by #141010
Open

[InstCombine] (fcmp une T, F) ? T : F --> T should not rely on the nsz flag on fcmp #140994

dtcxzyw opened this issue May 22, 2025 · 0 comments · May be fixed by #141010
Assignees

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented May 22, 2025

Reproducer: https://alive2.llvm.org/ce/z/_FgncC

define double @src(double %x, double %y) {
  %cmp = fcmp nsz une double %x, %y
  %cond = select i1 %cmp, double %x, double %y
  ret double %cond
}

define double @tgt(double returned %x, double %y) {
  ret double %x
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
double %x = #x8000000000000000 (-0.0)
double %y = #x0000000000000000 (+0.0)

Source:
i1 %cmp = #x0 (0)
double %cond = #x0000000000000000 (+0.0)

Target:
Source value: #x0000000000000000 (+0.0)
Target value: #x8000000000000000 (-0.0)

nsz flag should not be propagated from fcmp into select.

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

Successfully merging a pull request may close this issue.

1 participant