[llvm] [VPlan] Materialize vector trip count using VPInstructions. (PR #151925)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 10:10:27 PDT 2025


================
@@ -3191,6 +3191,62 @@ void VPlanTransforms::materializeBackedgeTakenCount(VPlan &Plan,
   BTC->replaceAllUsesWith(TCMO);
 }
 
+void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
+                                                 VPBasicBlock *VectorPHVPBB,
+                                                 bool TailByMasking,
+                                                 bool RequiresScalarEpilogue) {
+  VPValue &VectorTC = Plan.getVectorTripCount();
+  if (VectorTC.getNumUsers() == 0 ||
+      (VectorTC.isLiveIn() && VectorTC.getLiveInIRValue()))
----------------
lukel97 wrote:

Can the VectorTC ever not be a live in at this point? Apart from `materializeConstantVectorTripCount` does anything else change it to a recipe?

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


More information about the llvm-commits mailing list