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

[InstCombine] Commuted pattern is not handled #121700

Closed
dtcxzyw opened this issue Jan 5, 2025 · 0 comments · Fixed by #121737
Closed

[InstCombine] Commuted pattern is not handled #121700

dtcxzyw opened this issue Jan 5, 2025 · 0 comments · Fixed by #121737

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Jan 5, 2025

https://godbolt.org/z/aa5778bEf

define i8 @add-shl-sdiv-scalar0(i8 %x) {
  %sd = sdiv i8 %x, -4
  %sl = shl i8 %sd, 2
  %rz = add i8 %sl, %x
  ret i8 %rz
}

define i8 @add-shl-sdiv-scalar1(i8 %x) {
  %sd = sdiv i8 %x, -4
  %sl = shl i8 %sd, 2
  %rz = add i8 %x, %sl
  ret i8 %rz
}

Output:

define i8 @add-shl-sdiv-scalar0(i8 %x) {
  %rz = srem i8 %x, 4
  ret i8 %rz
}

define i8 @add-shl-sdiv-scalar1(i8 %x) {
  %sd = sdiv i8 %x, -4
  %sl = shl i8 %sd, 2
  %rz = add i8 %x, %sl
  ret i8 %rz
}
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