[llvm] [LoopVectorize][NFC] Cache the result of getVScaleForTuning (PR #124732)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 02:23:48 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();
----------------
david-arm wrote:
I'm not sure I follow. Are you worried about us initialising VScaleForTuning twice? I initially avoided doing this in the constructor because I thought then we'd be doing unnecessary work if the target doesn't support scalable vectors. However, I guess the attribute won't be present in that case so the check is cheap. I'm happy to move into a constructor in that case.
https://github.com/llvm/llvm-project/pull/124732
More information about the llvm-commits
mailing list