Issue 89390
Summary VectorCombine transform leading to srem by poison
Labels miscompilation, llvm:instcombine
Assignees
Reporter regehr
    https://alive2.llvm.org/ce/z/HRAkAK

this:
```llvm
define <4 x i32> @f(<4 x i32> %0, <4 x i32> %1) {
  %3 = srem <4 x i32> %1, %0
  %4 = srem <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %0
  %5 = shufflevector <4 x i32> %3, <4 x i32> %4, <4 x i32> <i32 0, i32 poison, i32 6, i32 3>
  ret <4 x i32> %5
}
```
is getting vector-combined to this:
```llvm
define <4 x i32> @f(<4 x i32> %0, <4 x i32> %1) {
  %3 = shufflevector <4 x i32> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 0, i32 poison, i32 6, i32 3>
  %4 = shufflevector <4 x i32> %0, <4 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 2, i32 3>
  %5 = srem <4 x i32> %3, %4
  ret <4 x i32> %5
}
```

but that poison in lane 1 is now problematic, this gives us full UB when it hits the srem

cc @nunoplopes @hatsunespica

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

Reply via email to