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] nsw flag should be dropped in Negator #112666

Closed
dtcxzyw opened this issue Oct 17, 2024 · 2 comments · Fixed by #112893
Closed

[InstCombine] nsw flag should be dropped in Negator #112666

dtcxzyw opened this issue Oct 17, 2024 · 2 comments · Fixed by #112893

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Oct 17, 2024

Reproducer: https://alive2.llvm.org/ce/z/ZFF_QK

define i8 @src(i8 %x, i8 %y, i1 %c) {
  %t0 = sub nsw i8 0, %x
  %t1 = select i1 %c, i8 %t0, i8 %x
  %t2 = sub i8 %y, %t1
  ret i8 %t2
}

define i8 @tgt(i8 %x, i8 %y, i1 %c) {
  %t0 = sub nsw i8 0, %x
  %1 = select i1 %c, i8 %x, i8 %t0
  %t2 = add i8 %1, %y
  ret i8 %t2
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i8 %x = #x80 (128, -128)
i8 %y = #x00 (0)
i1 %c = #x0 (0)

Source:
i8 %t0 = poison
i8 %t1 = #x80 (128, -128)
i8 %t2 = #x80 (128, -128)

Target:
i8 %t0 = poison
i8 %#1 = poison
i8 %t2 = poison
Source value: #x80 (128, -128)
Target value: poison
@AZero13
Copy link
Contributor

AZero13 commented Nov 13, 2024

Is this an issue in 19.x or just main?

@AZero13
Copy link
Contributor

AZero13 commented Nov 13, 2024

Confirmed this issue exists in 19.x

AZero13 pushed a commit to AZero13/llvm-project that referenced this issue Nov 14, 2024
Groverkss pushed a commit to iree-org/llvm-project that referenced this issue Nov 15, 2024
tru pushed a commit to AZero13/llvm-project that referenced this issue Nov 18, 2024
nikic pushed a commit to rust-lang/llvm-project that referenced this issue Nov 20, 2024
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.

2 participants