[llvm] [LoopVectorizer] Add a -force-vscale-for-tuning override option. (PR #156916)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 03:32:05 PDT 2025


================
@@ -1473,6 +1477,11 @@ class LoopVectorizationCostModel {
   /// vscale_range.min == vscale_range.max then return vscale_range.max, else
   /// return the value returned by the corresponding TTI method.
   void initializeVScaleForTuning() {
+    if (VScaleForTuningOpt.getNumOccurrences()) {
+      VScaleForTuning = VScaleForTuningOpt;
+      return;
+    }
----------------
davemgreen wrote:

> Is the purpose of the option to deliberately override the function attribute?

Either I think should be fine. As I said above I would let the user decide if they wanted to test a particular option, even if the vscale_range said otherwise.

> Does this have to be LV specific? Could this be handled in getVScaleForTuning?

Yeah that is the other option but it would mean duplicating per target. In this case it is also used for the gather/scatter overheads, so probably makes sense to override in the target. I will move it there in the new version.

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


More information about the llvm-commits mailing list