| Issue |
78960
|
| Summary |
[sve] A redundant csel instruction for overflow check
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
vfdff
|
* test: https://gcc.godbolt.org/z/jde11xv53
```
void mset (int *a, long long num) {
for (long long i=0; i< num; i++)
a[i] = 2;
}
```
* gcc: before the loop body
```
mset:
cmp x1, 0
ble .L1
mov x2, 0
cntw x3
whilelo p7.s, xzr, x1
mov z31.s, #2
```
* llvm: before the loop body
```
mset: // @mset
cmp x1, #1
b.lt .LBB0_3
cntw x8
mov z0.s, #2 // =0x2
mov x10, xzr
subs x9, x1, x8
csel x9, xzr, x9, lo ---> this is redundant compare to gcc ??
whilelo p0.s, xzr, x1
```
* the above redundant csel is used to check the overflow of **loop iv**, but it seems not necessary.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs