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 #121703

Closed
dtcxzyw opened this issue Jan 5, 2025 · 1 comment
Closed

[InstCombine] Commuted pattern is not handled #121703

dtcxzyw opened this issue Jan 5, 2025 · 1 comment
Assignees
Labels
invalid Resolved as invalid, i.e. not a bug llvm:instcombine missed-optimization

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Jan 5, 2025

https://godbolt.org/z/Ez3hEb8vs

define i32 @poo2(i32 %a, i32 %b, i32 %c, i32 %d) {
  %t0 = icmp slt i32 %a, %b
  %iftmp.0.0 = select i1 %t0, i32 -1, i32 0
  %t1 = and i32 %iftmp.0.0, %c
  %iftmp = select i1 %t0, i32 0, i32 -1
  %t2 = and i32 %iftmp, %d
  %t3 = or i32 %t1, %t2
  ret i32 %t3
}

define i32 @poo3(i32 %a, i32 %b, i32 %c, i32 %d) {
  %t0 = icmp sge i32 %a, %b
  %iftmp.0.0 = select i1 %t0, i32 0, i32 -1
  %t1 = and i32 %iftmp.0.0, %c
  %iftmp = select i1 %t0, i32 0, i32 -1
  %t2 = and i32 %iftmp, %d
  %t3 = or i32 %t1, %t2
  ret i32 %t3
}
define i32 @poo2(i32 %a, i32 %b, i32 %c, i32 %d) {
  %t0.not = icmp slt i32 %a, %b
  %t3 = select i1 %t0.not, i32 %c, i32 %d
  ret i32 %t3
}

define i32 @poo3(i32 %a, i32 %b, i32 %c, i32 %d) {
  %t0.not = icmp slt i32 %a, %b
  %1 = or i32 %c, %d
  %t3 = select i1 %t0.not, i32 %1, i32 0
  ret i32 %t3
}
@dtcxzyw dtcxzyw self-assigned this Jan 5, 2025
@dtcxzyw dtcxzyw added the invalid Resolved as invalid, i.e. not a bug label Jan 6, 2025
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Jan 6, 2025

Sorry, I forgot to handle the multi-use case.

@dtcxzyw dtcxzyw closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Resolved as invalid, i.e. not a bug llvm:instcombine missed-optimization
Projects
None yet
Development

No branches or pull requests

1 participant