[llvm] [VPlan] Expand VPWidenIntOrFpInductionRecipe into separate recipes (PR #118638)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 07:30:43 PST 2024


lukel97 wrote:

> > Although I just want to double check, I was thinking that doing the regular widening for now would still be correct. Can we convert it to VP intrinsics as a separate task after the EVL transform or is it needed for correctness?
> 
> I don't think regular widening of these inductions (i.e. without EVL) will be correct. The main problem is vsetvl's 6.3.2 so that if increment is VLMAX, last two iteration may result to overincrement. fyi: QEMU has special [`rvv_vl_half_avl`](https://lists.nongnu.org/archive/html/qemu-devel/2024-08/msg01060.html) option to properly test 6.3.2

This will allow us to use EVL as the increment value in the backedge value to deal with vsetvl's 6.3.2, instead of VF, e.g. something like

```llvm
%phi.next = add <vscale x 2 x i32> %phi.cur, %evl
```

My thinking is that it shouldn't matter if it's a vp.add or a regular widened add since the phi value should be correct across all lanes for the next iteration?

https://github.com/llvm/llvm-project/pull/118638


More information about the llvm-commits mailing list