[llvm] [SLP]Improve minbitwidth analysis for shifts. (PR #84356)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 02:37:24 PDT 2024


mikaelholmen wrote:

Hi @alexey-bataev ,

I think we get a miscompile with this patch
Reproduce with:
```
opt bbi-93743_2.ll -mtriple=aarch64 -passes=slp-vectorizer -S -o - -debug -slp-threshold=-100
```
The problem occurs if both inputs to foo are 0xffffffffffffffff.

Then the
```
  %5 = shufflevector <2 x i128> %3, <2 x i128> %4, <2 x i32> <i32 0, i32 3>
```
in the slp-vectorizer output will result in
```
<0x10000000000000000,poison>
```
due to the "nsw" on the "shl", and that poison then turns the return value from the function to be poison as well.

[bbi-93743_2.ll.gz](https://github.com/llvm/llvm-project/files/14756140/bbi-93743_2.ll.gz)


https://github.com/llvm/llvm-project/pull/84356


More information about the llvm-commits mailing list