[llvm-bugs] [Bug 47668] New: foldSelectICmpAndAnd should check whether the shift amount is less than bitwidth
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 28 07:27:39 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47668
Bug ID: 47668
Summary: foldSelectICmpAndAnd should check whether the shift
amount is less than bitwidth
Product: libraries
Version: trunk
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: juneyoung.lee at sf.snu.ac.kr
CC: llvm-bugs at lists.llvm.org
File: test/Transforms/InstCombine/select-of-bittest.ll
```
define i32 @f_var2(i32 %arg, i32 %arg1) {
%0:
%tmp = and i32 %arg, 1
%tmp2 = icmp eq i32 %tmp, 0
%tmp3 = lshr i32 %arg, %arg1
%tmp4 = and i32 %tmp3, 1
%tmp5 = select i1 %tmp2, i32 %tmp4, i32 1
ret i32 %tmp5
}
=>
define i32 @f_var2(i32 %arg, i32 %arg1) {
%0:
%1 = shl i32 1, %arg1
%2 = or i32 %1, 1
%3 = and i32 %2, %arg
%4 = icmp ne i32 %3, 0
%tmp5 = zext i1 %4 to i32
ret i32 %tmp5
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i32 %arg = #x00000001 (1)
i32 %arg1 = poison
Source:
i32 %tmp = #x00000001 (1)
i1 %tmp2 = #x0 (0)
i32 %tmp3 = poison
i32 %tmp4 = poison
i32 %tmp5 = #x00000001 (1)
Target:
i32 %1 = poison
i32 %2 = poison
i32 %3 = poison
i1 %4 = poison
i32 %tmp5 = poison
Source value: #x00000001 (1)
Target value: poison
```
Relevant revision: https://reviews.llvm.org/D45108
The revision includes Alive proof, but its precondition wasn't encoded.
I'll make a patch for this.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200928/7b0a970e/attachment.html>
More information about the llvm-bugs
mailing list