[llvm] [VPlan] Move predication to VPlanTransform (NFC). (PR #128420)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 03:31:08 PDT 2025


================
@@ -9542,27 +9311,21 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range,
       } else {
         Builder.insert(Recipe);
       }
-      if (Recipe->getNumDefinedValues() == 1)
+      if (Recipe->getNumDefinedValues() == 1) {
         SingleDef->replaceAllUsesWith(Recipe->getVPSingleValue());
-      else
+        // replaceAllUsesWith may invalidate the block mask cache. Update it.
+        // TODO: Include the masks as operands in the predicated VPlan directly
+        // to remove the need to keep a map of masks beyond the predication
+        // transform.
+        RecipeBuilder.updateBlockMaskCache(SingleDef,
+                                           Recipe->getVPSingleValue());
----------------
fhahn wrote:

Updated with an extra map, thanks

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


More information about the llvm-commits mailing list