[llvm] [LV] Enable the exit value optimization via SCEV for tail folding. (PR #210928)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 02:06:41 PDT 2026


================
@@ -1125,8 +1125,49 @@ optimizeLatchExitInductionUser(VPlan &Plan, VPValue *Op,
   return nullptr;
 }
 
+static VPValue *optimizeLatchExitIVUserViaSCEV(VPlan &Plan, VPValue *Op,
+                                               PredicatedScalarEvolution &PSE,
+                                               VPValue *ResumeTC,
+                                               const Loop *L) {
+  VPValue *Incoming;
+  if (!match(Op, m_ExtractLastLaneOfLastPart(m_VPValue(Incoming)))) {
+    VPValue *Mask;
+    if (!match(Op, m_ExtractLane(m_LastActiveLane(m_VPValue(Mask)),
+                                 m_VPValue(Incoming))) ||
+        !match(Mask, m_HeaderMask()))
+      return nullptr;
+  }
----------------
Mel-Chen wrote:

Sure, thanks. 5d0a65c3771b19551ea4810aa63d51b00569083f

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


More information about the llvm-commits mailing list