[llvm-branch-commits] [llvm] [LoopVectorize] Support vectorization of compressing patterns in VPlan (PR #140723)

Luke Lau via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 11 04:49:58 PST 2025


================
@@ -8430,6 +8479,46 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
   // bring the VPlan to its final state.
   // ---------------------------------------------------------------------------
 
+  // Adjust the recipes for any monotonic phis.
+  for (VPRecipeBase &R : HeaderVPBB->phis()) {
+    auto *MonotonicPhi = dyn_cast<VPMonotonicPHIRecipe>(&R);
----------------
lukel97 wrote:

If you use a regular VPInstruction::PHI instead of VPMonotonicPHIRecipe and set the underlying value to the monotonic phi, could you avoid the need for an extra recipe?

Would you be able to detect the monotonic phis by just calling `Legal->getMonotonicPHIs().find(Phi->getUnderlyingValue())`?

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


More information about the llvm-branch-commits mailing list