[llvm] [VPlan] Model branch cond to enter scalar epilogue in VPlan. (PR #92651)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 13:07:47 PDT 2024
================
@@ -8533,9 +8504,25 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
// modified; a basic block for the vector pre-header, followed by a region for
// the vector loop, followed by the middle basic block. The skeleton vector
// loop region contains a header and latch basic blocks.
+
+ // Add a check in the middle block to see if we have completed
+ // all of the iterations in the first vector loop. Three cases:
+ // 1) If we require a scalar epilogue, there is no conditional branch as
+ // we unconditionally branch to the scalar preheader. Do nothing.
+ // 2) If (N - N%VF) == N, then we *don't* need to run the remainder.
+ // Thus if tail is to be folded, we know we don't need to run the
+ // remainder and we can use the previous value for the condition (true).
+ // 3) Otherwise, construct a runtime check.
+ bool RequiresScalarEpilogueCheck =
----------------
fhahn wrote:
Now after updating all tests, there appears to be some changes only in the VPlan-native outer-loop vectorization path. Need to take a closer look.
https://github.com/llvm/llvm-project/pull/92651
More information about the llvm-commits
mailing list