[llvm] [VPlan] Extract reverse operation for reverse accesses (PR #146525)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 02:36:28 PST 2025


================
@@ -2625,6 +2648,34 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
       }
     }
     ToErase.push_back(CurRecipe);
+
+    // Convert general reverse operations on loaded results into vp.reverse,
+    // when the VPVectorEndPointerRecipe adjusting the access address uses EVL
+    // instead of VF.
+    if (auto *LoadR = dyn_cast<VPWidenLoadEVLRecipe>(EVLRecipe)) {
----------------
Mel-Chen wrote:

> We can almost do the slide with the splice intrinsic but unfortunately it's restricted to immediate offsets at the moment.

Yes, I think `vp.reverse(vec, true, evl)` is basically implemented as `llvm.vector.splice(llvm.vector.reverse(vec), all poison, -evl)`.

> 
> These are just my long-term thoughts btw, I don't think this should block this PR.



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


More information about the llvm-commits mailing list