From aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 25 Jun 2022 11:55:57 -0700 Subject: Don't use Optional::hasValue (NFC) --- llvm/lib/Analysis/InlineCost.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Analysis/InlineCost.cpp') diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 63fe651..f2dcaa8 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -703,8 +703,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { BlockFrequencyInfo *BFI = &(GetBFI(F)); assert(BFI && "BFI must be available"); auto ProfileCount = BFI->getBlockProfileCount(BB); - assert(ProfileCount.hasValue()); - if (ProfileCount.getValue() == 0) + assert(ProfileCount); + if (*ProfileCount == 0) ColdSize += Cost - CostAtBBStart; } @@ -828,14 +828,14 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { } auto ProfileCount = CalleeBFI->getBlockProfileCount(&BB); - assert(ProfileCount.hasValue()); - CurrentSavings *= ProfileCount.getValue(); + assert(ProfileCount); + CurrentSavings *= *ProfileCount; CycleSavings += CurrentSavings; } // Compute the cycle savings per call. auto EntryProfileCount = F.getEntryCount(); - assert(EntryProfileCount.hasValue() && EntryProfileCount->getCount()); + assert(EntryProfileCount && EntryProfileCount->getCount()); auto EntryCount = EntryProfileCount->getCount(); CycleSavings += EntryCount / 2; CycleSavings = CycleSavings.udiv(EntryCount); @@ -1800,12 +1800,12 @@ void InlineCostCallAnalyzer::updateThreshold(CallBase &Call, Function &Callee) { // return min(A, B) if B is valid. auto MinIfValid = [](int A, Optional B) { - return B ? std::min(A, B.getValue()) : A; + return B ? std::min(A, *B) : A; }; // return max(A, B) if B is valid. auto MaxIfValid = [](int A, Optional B) { - return B ? std::max(A, B.getValue()) : A; + return B ? std::max(A, *B) : A; }; // Various bonus percentages. These are multiplied by Threshold to get the -- cgit v1.1