[llvm] [LV, VPlan] Check if plan is compatible to EVL transform (PR #92092)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 03:09:52 PDT 2024


================
@@ -1306,7 +1306,16 @@ void VPlanTransforms::addActiveLaneMask(
 /// %NextEVLIV = add IVSize (cast i32 %VPEVVL to IVSize), %EVLPhi
 /// ...
 ///
-void VPlanTransforms::addExplicitVectorLength(VPlan &Plan) {
+bool VPlanTransforms::addExplicitVectorLength(VPlan &Plan) {
+  // EVL transform doesn't support backends where EVL diffs from RuntimeVF
+  // in the second-to-last iteration.
+  // Return false if any recipes rely on RuntimeVF.
+  if (any_of(Plan.getVectorLoopRegion()->getEntryBasicBlock()->phis(),
+             [](VPRecipeBase &Phi) {
+               return (isa<VPWidenIntOrFpInductionRecipe>(&Phi) ||
+                       isa<VPWidenPointerInductionRecipe>(&Phi));
+             }))
+    return false;
   VPBasicBlock *Header = Plan.getVectorLoopRegion()->getEntryBasicBlock();
----------------
fhahn wrote:

Move up and use 

```
if (any_of(Header->phis())...
```

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


More information about the llvm-commits mailing list