[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


================
@@ -929,11 +952,12 @@ bool FunctionSpecializer::findSpecializations(Function *F, unsigned FuncSize,
       };
 
       // Discard unprofitable specialisations.
-      if (!IsProfitable(B, Score, FuncSize, FunctionGrowth[F], Visitor))
+      if (!IsProfitable(CodeSizeSavings, LatencySavings, Score, FuncSize,
+                        FunctionGrowth[F], Visitor))
         continue;
 
       // Create a new specialisation entry.
-      Score += std::max(B.CodeSize, B.Latency);
+      Score += std::max(CodeSizeSavings, LatencySavings);
----------------
labrinea wrote:

I think we can move this inside the lamda too, just before the `return true` statement at the end.

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


More information about the llvm-commits mailing list