-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[RISCV] Handle recurrences in VLOptimizer #149354
Copy link
Copy link
Closed
Labels
Description
With EVL tail folding given a loop with an induction variable:
void f(int *x, int n) {
for (int i = 0; i < n; i++)
x[i] += i;
}We will have an extra vsetvli toggle because we can't currently reduce the VL of the induction increment, which is used by a phi node forming a cycle:
.LBB0_2: # %vector.body
# =>This Inner Loop Header: Depth=1
sub a3, a1, a2
sh2add a4, a2, a0
vsetvli a3, a3, e32, m2, ta, ma
vle32.v v10, (a4)
add a2, a2, a3
vadd.vv v10, v10, v8
vse32.v v10, (a4)
vsetvli a4, zero, e32, m2, ta, ma
vadd.vx v8, v8, a3
bne a2, a1, .LBB0_2
I have a patch that I plan on posting shortly that handles this, based off the work here: https://www.youtube.com/watch?v=Mfb5fRSdJAc
Reactions are currently unavailable