| Issue |
172089
|
| Summary |
Redundant sext.w in signed overflow checking with -ftrapv
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
camel-cdr
|
I noticed a redundant sext.w when enabling -ftrapv: https://godbolt.org/z/4x3end6Gb
```c
int compare(const void* untyped_left, const void* untyped_right) {
const int* left = untyped_left;
const int* right = untyped_right;
return *right - *left;
}
```
generates:
```
compare:
lw a1, 0(a1)
lw a2, 0(a0)
sub a0, a1, a2
subw a1, a1, a2
bne a1, a0, .LBB0_2
sext.w a0, a0 # redundant, because a0 == a1
ret
.LBB0_2:
unimp
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs