Issue 89500
Summary [InstCombine] Miscompilation with poison vectors in `src_and_eq_C_xor_OrAndNotC `
Labels miscompilation, llvm:instcombine
Assignees
Reporter dtcxzyw
    Alive2: https://alive2.llvm.org/ce/z/yB3oAx
```
define <2 x i32> @src_and_eq_C_xor_OrAndNotC(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2) {
entry:
  %and = and <2 x i32> %1, %0
  %cmp = icmp eq <2 x i32> %and, %2
  %xor = xor <2 x i32> %1, %0
  %or = or <2 x i32> %1, %0
 %not = xor <2 x i32> %2, <i32 -1, i32 poison>
  %and1 = and <2 x i32> %or, %not
  %cond = select <2 x i1> %cmp, <2 x i32> %xor, <2 x i32> %and1
 ret <2 x i32> %cond
}
```
```

----------------------------------------
define <2 x i32> @src_and_eq_C_xor_OrAndNotC(<2 x i32> %#0, <2 x i32> %#1, <2 x i32> %#2) {
entry:
  %and = and <2 x i32> %#1, %#0
  %cmp = icmp eq <2 x i32> %and, %#2
  %xor = xor <2 x i32> %#1, %#0
  %or = or <2 x i32> %#1, %#0
  %not = xor <2 x i32> %#2, { 4294967295, poison }
  %and1 = and <2 x i32> %or, %not
  %cond = select <2 x i1> %cmp, <2 x i32> %xor, <2 x i32> %and1
  ret <2 x i32> %cond
}
=>
define <2 x i32> @src_and_eq_C_xor_OrAndNotC(<2 x i32> %#0, <2 x i32> %#1, <2 x i32> %#2) nofree willreturn memory(none) {
entry:
  %or = or <2 x i32> %#1, %#0
  %not = xor <2 x i32> %#2, { 4294967295, poison }
  %and1 = and <2 x i32> %or, %not
  ret <2 x i32> %and1
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
<2 x i32> %#0 = < poison, #x00000000 (0) >
<2 x i32> %#1 = < poison, #x00000000 (0) >
<2 x i32> %#2 = < poison, #x00000000 (0) >

Source:
<2 x i32> %and = < poison, #x00000000 (0) >
<2 x i1> %cmp = < poison, #x1 (1) >
<2 x i32> %xor = < poison, #x00000000 (0) >
<2 x i32> %or = < poison, #x00000000 (0) >
<2 x i32> %not = < poison, poison >
<2 x i32> %and1 = < poison, poison >
<2 x i32> %cond = < poison, #x00000000 (0) >

Target:
<2 x i32> %or = < poison, #x00000000 (0) >
<2 x i32> %not = < poison, poison >
<2 x i32> %and1 = < poison, poison >
Source value: < poison, #x00000000 (0) >
Target value: < poison, poison >

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

cc @nikic
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to