[llvm] [LV] Check if the VF is scalar by VFRange instead of VPlan in `handleUncountableEarlyExit` NFC. (PR #135294)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 16:38:11 PDT 2025


================
@@ -2436,13 +2438,20 @@ void VPlanTransforms::handleUncountableEarlyExit(
       ExitIRI->extractLastLaneOfOperand(MiddleBuilder);
     }
     // Add the incoming value from the early exit.
-    if (!IncomingFromEarlyExit->isLiveIn() && !Plan.hasScalarVFOnly()) {
-      VPValue *FirstActiveLane = EarlyExitB.createNaryOp(
-          VPInstruction::FirstActiveLane, {EarlyExitTakenCond}, nullptr,
-          "first.active.lane");
-      IncomingFromEarlyExit = EarlyExitB.createNaryOp(
-          Instruction::ExtractElement, {IncomingFromEarlyExit, FirstActiveLane},
-          nullptr, "early.exit.value");
+    if (!IncomingFromEarlyExit->isLiveIn()) {
+      // Limit range to scalar VF only, if the range contains the scalar VF.
+      bool IsVectorVF = LoopVectorizationPlanner::getDecisionAndClampRange(
+          [&](ElementCount VF) { return VF.isVector(); }, Range);
----------------
ElvisWang123 wrote:

Done, thanks.

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


More information about the llvm-commits mailing list