Skip to content

[InstCombine] disjoint should be dropped in foldSelectICmpEq #121583

Open
@dtcxzyw

Description

Alive2: https://alive2.llvm.org/ce/z/am7W57


----------------------------------------
define i32 @src(i32 noundef %x, i32 noundef %y, i32 %c) {
entry:
  %xor = xor i32 noundef %y, noundef %x
  %cmp = icmp eq i32 %xor, %c
  %and = and i32 noundef %x, noundef %y
  %or = or disjoint i32 noundef %y, noundef %x
  %not = xor i32 %c, 4294967295
  %and1 = and i32 %or, %not
  %cond = select i1 %cmp, i32 %and, i32 %and1
  ret i32 %cond
}
=>
define i32 @src(i32 noundef %x, i32 noundef %y, i32 %c) {
entry:
  %or = or disjoint i32 noundef %y, noundef %x
  %not = xor i32 %c, 4294967295
  %and1 = and i32 %or, %not
  ret i32 %and1
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i32 noundef %x = #x0000000f (15)
i32 noundef %y = #x0000000f (15)
i32 %c = #x00000000 (0)

Source:
i32 %xor = #x00000000 (0)
i1 %cmp = #x1 (1)
i32 %and = #x0000000f (15)
i32 %or = poison
i32 %not = #xffffffff (4294967295, -1)
i32 %and1 = poison
i32 %cond = #x0000000f (15)

Target:
i32 %or = poison
i32 %not = #xffffffff (4294967295, -1)
i32 %and1 = poison
Source value: #x0000000f (15)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions