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

!unpredictable not propagated when combining select+add #63910

Closed
chfast opened this issue Jul 17, 2023 · 1 comment
Closed

!unpredictable not propagated when combining select+add #63910

chfast opened this issue Jul 17, 2023 · 1 comment

Comments

@chfast
Copy link
Member

chfast commented Jul 17, 2023

When instcombine combines select+add into add+select the !unpredictable metadata is lost on the way.

define i64 @add_select(i1 %cond, i64 %x, i64 %y) {
  %add = add i64 %x, %y
  %ret = select i1 %cond, i64 %add, i64 %x, !unpredictable !0
  ret i64 %ret
}

!0 = !{}

define i64 @add_select(i1 %cond, i64 %x, i64 %y) {
  %add = select i1 %cond, i64 %y, i64 0
  %ret = add i64 %add, %x
  ret i64 %ret
}

https://godbolt.org/z/qq61noErs

@chfast
Copy link
Member Author

chfast commented Jul 17, 2023

Proposed fix: https://reviews.llvm.org/D155461.

@chfast chfast closed this as completed in 9663180 Jul 19, 2023
@chfast chfast removed their assignment Jul 19, 2023
veselypeta pushed a commit to veselypeta/cherillvm that referenced this issue Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant