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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 08:08:04 PDT 2025


================
@@ -2339,6 +2355,39 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
       CurVPV->replaceAllUsesWith(EVLRecipe->getVPSingleValue());
     }
     ToErase.push_back(CurRecipe);
+
+    // Convert general reverse operations on loaded values and stored values
+    // into vp.reverse, when the VPVectorEndPointerRecipe adjusting the access
+    // address uses EVL instead of VF.
+    // TODO: Extend conversion along the def-use/use-def chain, as reverse
+    // operations may be eliminated or moved in the future.
+    if (auto *MemR = dyn_cast<VPWidenMemoryRecipe>(EVLRecipe);
+        MemR && match(MemR->getAddr(),
+                      m_VectorEndPointer(m_VPValue(), m_Specific(&EVL)))) {
----------------
artagnon wrote:

```suggestion
    if (auto *MemR = dyn_cast<VPWidenMemoryRecipe>(EVLRecipe))
        if (match(MemR->getAddr(),
                      m_VectorEndPointer(m_VPValue(), m_Specific(&EVL))))) {
```

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


More information about the llvm-commits mailing list