[llvm] [LoopVectorize][NFC] Rewrite tests to check output of vplan cost model (PR #113697)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 05:33:43 PST 2024


================
@@ -7403,7 +7404,20 @@ InstructionCost LoopVectorizationPlanner::cost(VPlan &Plan,
 
   // Now compute and add the VPlan-based cost.
   Cost += Plan.cost(VF, CostCtx);
-  LLVM_DEBUG(dbgs() << "Cost for VF " << VF << ": " << Cost << "\n");
+#ifndef NDEBUG
+  unsigned EstimatedWidth = VF.getKnownMinValue();
+  if (VF.isScalable())
+    if (std::optional<unsigned> VScale = getVScaleForTuning(OrigLoop, TTI))
+      EstimatedWidth *= *VScale;
----------------
fhahn wrote:

It would probably be convenient to have a simple helper for that as we do this in more and more places now?

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


More information about the llvm-commits mailing list