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] disjoint should be dropped in foldSelectICmpEq #121583

Open
dtcxzyw opened this issue Jan 3, 2025 · 0 comments · May be fixed by #121635
Open

[InstCombine] disjoint should be dropped in foldSelectICmpEq #121583

dtcxzyw opened this issue Jan 3, 2025 · 0 comments · May be fixed by #121635

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Jan 3, 2025

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