Skip to content

[InstCombine] Commuted pattern is not handled #121703

@dtcxzyw

Description

@dtcxzyw

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
}

Metadata

Metadata

Assignees

Labels

invalidResolved as invalid, i.e. not a bugllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions