[llvm] [LV] Compute register usage for interleaving on VPlan. (PR #126437)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 19 06:13:37 PDT 2025


================
@@ -4878,8 +4879,232 @@ void LoopVectorizationCostModel::collectElementTypesForWidening() {
   }
 }
 
+/// Estimate the register usage for \p Plan and vectorization factors in \p VFs.
+/// Returns the register usage for each VF in \p VFs.
+static SmallVector<LoopVectorizationCostModel::RegisterUsage, 8>
+calculateRegisterUsage(VPlan &Plan, ArrayRef<ElementCount> VFs,
----------------
SamTebbs33 wrote:

When moving VF pruning to be after VPlan construction, the assertion that checks if the new and legacy cost models disagree on the VF fails since they're each checking different things. The existing calculateRegisterUsage function that just takes the VF has been useful to stop the assertion failing, since we can check if the VPlan-based one got a different outcome to it and so not trip the assertion.

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


More information about the llvm-commits mailing list