[llvm] [InlineOrder] fix the calculation of Cost for CostBenefitPriority (PR #86630)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 14:34:31 PDT 2024


================
@@ -114,7 +114,10 @@ class CostBenefitPriority {
   CostBenefitPriority(const CallBase *CB, FunctionAnalysisManager &FAM,
                       const InlineParams &Params) {
     auto IC = getInlineCostWrapper(const_cast<CallBase &>(*CB), FAM, Params);
-    Cost = IC.getCost();
+    if (IC.isVariable())
----------------
wlei-llvm wrote:

Does it always need to check `isVariable` for the return of `getInlineCostWrapper`? As far as I can see, there are three usages of `getInlineCostWrapper` and all needs those checks, maybe we can just move it into `getInlineCostWrapper`?

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


More information about the llvm-commits mailing list