[llvm] [FuncSpec] Only compute Latency bonus when necessary (PR #113159)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 10:32:06 PDT 2024
================
@@ -889,18 +910,20 @@ bool FunctionSpecializer::findSpecializations(Function *F, unsigned FuncSize,
unsigned Score = 0;
InstCostVisitor Visitor = getInstCostVisitorFor(F);
for (ArgInfo &A : S.Args) {
- CodeSize += Visitor.getCodeSizeBonus(A.Formal, A.Actual);
+ CodeSize += Visitor.getCodeSizeSavingsForArg(A.Formal, A.Actual);
Score += getInliningBonus(A.Formal, A.Actual);
}
- CodeSize += Visitor.getCodeSizeBonusFromPendingPHIs();
+ CodeSize += Visitor.getCodeSizeSavingsFromPendingPHIs();
LLVM_DEBUG(dbgs() << "FnSpecialization: Specialization bonus {CodeSize = "
<< CodeSize << ", Inlining = " << Score << "}\n");
- Bonus B = {CodeSize, 0};
- FunctionGrowth[F] += FuncSize - B.CodeSize;
+ unsigned LatencySavings = 0;
+ unsigned CodeSizeSavings = getCostValue(CodeSize);
+ FunctionGrowth[F] += FuncSize - CodeSizeSavings;
----------------
labrinea wrote:
Can we also sink all three of the above statements inside the lambda, to the point of their use? Since this isn't a read-only lambda anymore I think it makes sense to get rid of the parameters and capture the scope by reference.
https://github.com/llvm/llvm-project/pull/113159
More information about the llvm-commits
mailing list