[llvm] [VPlan] Emit VPVectorEndPointerRecipe for reverse interleave pointer adjustment (PR #144864)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 02:47:10 PDT 2025


================
@@ -2489,6 +2489,22 @@ void VPlanTransforms::createInterleaveGroups(
       Addr = InBounds ? B.createInBoundsPtrAdd(InsertPos->getAddr(), OffsetVPV)
                       : B.createPtrAdd(InsertPos->getAddr(), OffsetVPV);
     }
+    // If the group is reverse, adjust the index to refer to the last vector
+    // lane instead of the first. We adjust the index from the first vector
+    // lane, rather than directly getting the pointer for lane VF - 1, because
+    // the pointer operand of the interleaved access is supposed to be uniform.
+    if (IG->isReverse()) {
+      auto *GEP = dyn_cast<GetElementPtrInst>(
+          getLoadStorePointerOperand(IRInsertPos)->stripPointerCasts());
----------------
fhahn wrote:

would be good to share the logic to determine inbounds from the GEP with similar code above

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


More information about the llvm-commits mailing list