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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 04:48:00 PST 2024


================
@@ -7382,7 +7382,15 @@ 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;
+  LLVM_DEBUG(dbgs() << "Cost for VF " << VF << ": " << Cost
+                    << " (Estimated cost per lane: " << (Cost / EstimatedWidth)
----------------
david-arm wrote:

I've tried to do this, although it's not print with LLVM's ostreams. :)

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


More information about the llvm-commits mailing list