Incorrect transforms for -hack-scf
Open
bug
- Dominant language
- LLVM
- Stars
- 729
- Forks
- 110
- Avg merge
- 17h 51m
- Merged PRs (30d)
- 23
Description
Recently uncovered this testing abs_diff. The transformations in the pass are not safe if overflow occurs. For example signed greater than (a > b) is implemented as:
```
%sub = sub i32 %a, %b
%sub1 = sub i32 %sub, 1
%and = and i32 %sub1, 0x80000000
%eq = OpIEqual i32 %and, 0
```
Here is a problematic 8-bit case:
```
a = 0x7f
b = 0x8f
%sub = 0xf0
%sub1 = 0xef
%and = 0x80
%eq = false
```
The transform needs to handle more cases in case of potential wrapping.
Contributor guide
Assessment
This issue has not been assessed yet.