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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 02:54:04 PDT 2025


================
@@ -2380,13 +2381,19 @@ void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan) {
 
 void VPlanTransforms::handleUncountableEarlyExit(
     VPlan &Plan, ScalarEvolution &SE, Loop *OrigLoop,
-    BasicBlock *UncountableExitingBlock, VPRecipeBuilder &RecipeBuilder) {
+    BasicBlock *UncountableExitingBlock, VPRecipeBuilder &RecipeBuilder,
+    VFRange &Range) {
   VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion();
   auto *LatchVPBB = cast<VPBasicBlock>(LoopRegion->getExiting());
   VPBuilder Builder(LatchVPBB->getTerminator());
   auto *MiddleVPBB = Plan.getMiddleBlock();
   VPValue *IsEarlyExitTaken = nullptr;
 
+  // Clamp the range that make sure we insert extractElement for incoming value
----------------
fhahn wrote:

```suggestion
  // Limit range to scalar VF only, if the range contains the scalar VF.
```

Also, would be good to move to the use, otherwise we may clamp unnecessarily if no extract needs to be inserted>

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


More information about the llvm-commits mailing list