[llvm] [LV][NFC] Factor out MinBWs of values from the cost model (PR #194492)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 02:25:09 PDT 2026
================
@@ -563,6 +563,15 @@ bool VFSelectionContext::runtimeChecksRequired() {
return false;
}
+const MapVector<Instruction *, uint64_t> &
+VFSelectionContext::getMinimalBitwidths() {
+ if (!MinBWsComputed) {
+ MinBWs = computeMinimumValueSizes(TheLoop->getBlocks(), *DB, &TTI);
----------------
david-arm wrote:
Can this initialisation be done in the constructor for VFSelectionContext similar to what we do for VScaleForTuning, e.g.
```
VFSelectionContext(const TargetTransformInfo &TTI,
const LoopVectorizationLegality *Legal,
const Loop *TheLoop, const Function &F,
PredicatedScalarEvolution &PSE,
OptimizationRemarkEmitter *ORE,
const LoopVectorizeHints *Hints, bool OptForSize)
: TTI(TTI), Legal(Legal), TheLoop(TheLoop), F(F), PSE(PSE), ORE(ORE),
Hints(Hints),
CostKind(F.hasMinSize() ? TTI::TCK_CodeSize : TTI::TCK_RecipThroughput),
OptForSize(OptForSize) {
initializeVScaleForTuning();
}
```
That avoids having to compute this lazily and you can remove the `MinBWsComputed` flag.
https://github.com/llvm/llvm-project/pull/194492
More information about the llvm-commits
mailing list