Issue 91178
Summary [InstCombine] Miscompilation
Labels miscompilation, llvm:instcombine
Assignees dtcxzyw
Reporter dtcxzyw
    Reduced test case: https://alive2.llvm.org/ce/z/_JyUGw
```
define i8 @func78(i1 %0, i8 %1) {
  %3 = zext i1 %0 to i8
  %4 = shl i8 %3, %1
  %5 = freeze i8 %4
  %6 = select i1 %0, i8 0, i8 %5
  %7 = call i8 @llvm.fshr.i8(i8 0, i8 %5, i8 %6)
  ret i8 %7
}
```

```
----------------------------------------
define i8 @func78(i1 %#0, i8 %#1) {
#2:
  %#3 = zext i1 %#0 to i8
  %#4 = shl i8 %#3, %#1
  %#5 = freeze i8 %#4
  %#6 = select i1 %#0, i8 0, i8 %#5
  %#7 = fshr i8 0, i8 %#5, i8 %#6
  ret i8 %#7
}
=>
define i8 @func78(i1 %#0, i8 %#1) nofree noundef willreturn memory(none) {
#2:
  %#3 = zext i1 %#0 to i8
  %#4 = shl nuw i8 %#3, %#1
  %#5 = freeze i8 %#4
  ret i8 %#5
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
i1 %#0 = #x0 (0)
i8 %#1 = #x08 (8)

Source:
i8 %#3 = #x00 (0)
i8 %#4 = poison
i8 %#5 = #x00 (0)
i8 %#6 = #x00 (0)
i8 %#7 = #x00 (0)

Target:
i8 %#3 = #x00 (0)
i8 %#4 = poison
i8 %#5 = #x9d (157, -99)
Source value: #x00 (0)
Target value: #x9d (157, -99)

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

Reply via email to