| Issue |
113865
|
| Summary |
Wrong `nsw`, `nuw` flag set on undefined values
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
bongjunj
|
Alive2 report: https://alive2.llvm.org/ce/z/9Mdkez
```llvm
----------------------------------------
define i16 @fold_add_udiv_urem_without_noundef.2(i16 %val) {
entry:
%#0 = srem i16 %val, 10
%#1 = mul i16 %#0, %#0
%rem = urem i16 %val, 10
%add = add i16 %#1, %rem
ret i16 %add
}
=>
define i16 @fold_add_udiv_urem_without_noundef.2(i16 %val) {
entry:
%#0 = srem i16 %val, 10
%#1 = mul nsw i16 %#0, %#0
%rem = urem i16 %val, 10
%add = add nsw nuw i16 %#1, %rem
ret i16 %add
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i16 %val = undef
Source:
i16 %#0 = #x0000 (0) [based on undef value]
i16 %#1 = #x0000 (0)
i16 %rem = #x0000 (0) [based on undef value]
i16 %add = #x0000 (0)
Target:
i16 %#0 = #xfff7 (65527, -9)
i16 %#1 = #xfff7 (65527, -9)
i16 %rem = #x0009 (9)
i16 %add = poison
Source value: #x0000 (0)
Target value: poison
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs