Issue 114183
Summary [InstCombine] Wrong negation of vector subtraction
Labels new issue
Assignees
Reporter bongjunj
    https://github.com/llvm/llvm-project/blob/9a7519fdb39f21a807189e1ed06826b43db929e1/llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp#L231-L239

Alive2 report: https://alive2.llvm.org/ce/z/eurJYC

```llvm
----------------------------------------
define <4 x i16> @vec_const_sub_const_sub.2(<4 x i16> %arg) {
#0:
  %t0 = sub nuw <4 x i16> { 8, 8, 8, 8 }, %arg
  %#1 = mul <4 x i16> %t0, { 0, undef, undef, 3 }
  %t1 = sub nsw nuw <4 x i16> { 2, 2, 2, 2 }, %#1
  ret <4 x i16> %t1
}
=>
define <4 x i16> @vec_const_sub_const_sub.2(<4 x i16> %arg) {
#0:
  %#1 = mul <4 x i16> %arg, { 0, undef, undef, 3 }
  %t1 = add <4 x i16> %#1, { 2, 2, 2, 65514 }
  ret <4 x i16> %t1
}
Transformation doesn't verify!

ERROR: Target's return value is more undefined

Example:
<4 x i16> %arg = < poison, #x0008 (8), #x0000 (0), poison >

Source:
<4 x i16> %t0 = < poison, #x0000 (0), #x0008 (8), poison >
<4 x i16> %#1 = < poison, #x0000 (0), #x0000 (0)	[based on undef value], poison >
<4 x i16> %t1 = < poison, #x0002 (2), #x0002 (2), poison >

Target:
<4 x i16> %#1 = < poison, #x0000 (0), #x0000 (0), poison >
<4 x i16> %t1 = < poison, #x0002 (2), #x0002 (2), poison >
Source value: < poison, #x0002 (2), #x0002 (2), poison >
Target value: < poison, #x0002 (2), #x0002 (2), poison >

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to