Issue 91309
Summary Miscompile with slp-vectorizer after "[SLP][NFC]Walk over entries, not single values."
Labels new issue
Assignees
Reporter mikaelholmen
    llvm commit: d838e5b3e86e
Reproduce with
```opt -mtriple=aarch64 -passes=slp-vectorizer bbi-95270.ll -S -o - -slp-threshold=-100```
Result:
```
define i16 @foo() {
entry:
 %lnot = xor i1 false, true
  %lnot.ext = zext i1 %lnot to i16
  %add = add nsw i16 0, %lnot.ext
  %lnot5 = xor i1 false, true
  %lnot.ext6 = zext i1 %lnot5 to i16
  %add7 = add nsw i16 %add, %lnot.ext6
  ret i16 %add7
}
```
The input program returns 0, but after slp-vectorizer you can see that the function returns 2.
This starts happening with https://github.com/llvm/llvm-project/commit/938a73422e0b964eba16f272acdfae1d0281772c
The patch says "[SLP][NFC]Walk over entries, not single values." but it seems to not be NFC.
 
Before that patch we get
```
define i16 @foo() {
entry:
  %lnot = xor i1 true, true
  %lnot.ext = zext i1 %lnot to i16
  %add = add nsw i16 0, %lnot.ext
  %lnot5 = xor i1 true, true
 %lnot.ext6 = zext i1 %lnot5 to i16
  %add7 = add nsw i16 %add, %lnot.ext6
  ret i16 %add7
}
```
which still returns 0 as it should.
Note the difference in the "xor" instructions.
[bbi-95270.ll.gz](https://github.com/llvm/llvm-project/files/15233200/bbi-95270.ll.gz)

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

Reply via email to