[llvm] [LoopVectorize][NFC] Cache the result of getVScaleForTuning (PR #124732)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 12:21:23 PST 2025


================
@@ -3838,6 +3861,11 @@ FixedScalableVFPair LoopVectorizationCostModel::computeFeasibleMaxVF(
   if (!Legal->isSafeForAnyVectorWidth())
     this->MaxSafeElements = MaxSafeElements;
 
+  if (MaxSafeScalableVF != ElementCount::getScalable(0)) {
+    // Cache the value of vscale for tuning, since we'll need it.
+    initializeVScaleForTuning();
----------------
fhahn wrote:

IIUC there's no nice sentinel value we could use to detect calling `getVScaleForTuning` before initialization.  Would be good to either detect calling before initialization or possibly initialize in constructor?

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


More information about the llvm-commits mailing list