[llvm] [FuncSpec] Only compute Latency bonus when necessary (PR #113159)

Hari Limaye via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 04:11:55 PDT 2024


================
@@ -819,6 +831,15 @@ static Function *cloneCandidateFunction(Function *F, unsigned NSpecs) {
   return Clone;
 }
 
+static unsigned getCostValue(const Cost &C) {
+  int64_t Value = *C.getValue();
+
+  assert(Value >= 0 && "CodeSize and Latency cannot be negative");
----------------
hazzlim wrote:

Yeah good point - I'm not sure what makes the most sense either. I've added an explanatory comment documenting the non-negative assumptions and how this is always true for the Cost kinds we use in FuncSpec (TCK_CodeSize and TCK_Latency).

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


More information about the llvm-commits mailing list