diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -831,10 +831,8 @@ BlockFrequencyInfo *CalleeBFI = &(GetBFI(F)); assert(CalleeBFI); - // The cycle savings expressed as the sum of InstrCost - // multiplied by the estimated dynamic count of each instruction we can - // avoid. Savings come from the call site cost, such as argument setup and - // the call instruction, as well as the instructions that are folded. + // The cycle savings expressed as savings come from the call site cost, such as argument setup and + // the call instruction. // // We use 128-bit APInt here to avoid potential overflow. This variable // should stay well below 10^^24 (or 2^^80) in practice. This "worst" case @@ -843,36 +841,6 @@ // period on a 4GHz machine. APInt CycleSavings(128, 0); - for (auto &BB : F) { - APInt CurrentSavings(128, 0); - for (auto &I : BB) { - if (BranchInst *BI = dyn_cast(&I)) { - // Count a conditional branch as savings if it becomes unconditional. - if (BI->isConditional() && - isa_and_nonnull( - SimplifiedValues.lookup(BI->getCondition()))) { - CurrentSavings += InstrCost; - } - } else if (Value *V = dyn_cast(&I)) { - // Count an instruction as savings if we can fold it. - if (SimplifiedValues.count(V)) { - CurrentSavings += InstrCost; - } - } - } - - auto ProfileCount = CalleeBFI->getBlockProfileCount(&BB); - CurrentSavings *= *ProfileCount; - CycleSavings += CurrentSavings; - } - - // Compute the cycle savings per call. - auto EntryProfileCount = F.getEntryCount(); - assert(EntryProfileCount && EntryProfileCount->getCount()); - auto EntryCount = EntryProfileCount->getCount(); - CycleSavings += EntryCount / 2; - CycleSavings = CycleSavings.udiv(EntryCount); - // Compute the total savings for the call site. auto *CallerBB = CandidateCall.getParent(); BlockFrequencyInfo *CallerBFI = &(GetBFI(*(CallerBB->getParent())));