[llvm] [VPlan] Materialize VectorTripCount in narrowInterleaveGroups. (PR #182146)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 06:37:13 PST 2026


================
@@ -5424,6 +5431,16 @@ VPlanTransforms::narrowInterleaveGroups(VPlan &Plan,
   if (StoreGroups.empty())
     return nullptr;
 
+  // Determine if a scalar epilogue is required. The middle block has exactly 2
+  // successors in the normal case, and 1 successor when a scalar epilogue must
+  // execute (unconditional branch to scalar preheader).
+  bool RequiresScalarEpilogue =
+      Plan.getMiddleBlock()->getNumSuccessors() == 1 &&
+      Plan.getMiddleBlock()->getSingleSuccessor() == Plan.getScalarPreheader();
+  // Bail out for tail-folding (middle block with a single successor to exit).
+  if (Plan.getMiddleBlock()->getNumSuccessors() != 2 && !RequiresScalarEpilogue)
+    return nullptr;
----------------
artagnon wrote:

Redundant getNumSccessors call after getSingleSucessor?

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


More information about the llvm-commits mailing list