diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-25 11:56:50 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-25 11:56:50 -0700 |
commit | 3b7c3a654c9175f41ac871a937cbcae73dfb3c5d (patch) | |
tree | 21094939ea6c8b726c481d7b28eaf4ea27c64008 /llvm/lib/Analysis/InlineCost.cpp | |
parent | aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d (diff) | |
download | llvm-3b7c3a654c9175f41ac871a937cbcae73dfb3c5d.zip llvm-3b7c3a654c9175f41ac871a937cbcae73dfb3c5d.tar.gz llvm-3b7c3a654c9175f41ac871a937cbcae73dfb3c5d.tar.bz2 |
Revert "Don't use Optional::hasValue (NFC)"
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index f2dcaa8..63fe651 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); - if (*ProfileCount == 0) + assert(ProfileCount.hasValue()); + if (ProfileCount.getValue() == 0) ColdSize += Cost - CostAtBBStart; } @@ -828,14 +828,14 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { } auto ProfileCount = CalleeBFI->getBlockProfileCount(&BB); - assert(ProfileCount); - CurrentSavings *= *ProfileCount; + assert(ProfileCount.hasValue()); + CurrentSavings *= ProfileCount.getValue(); CycleSavings += CurrentSavings; } // Compute the cycle savings per call. auto EntryProfileCount = F.getEntryCount(); - assert(EntryProfileCount && EntryProfileCount->getCount()); + assert(EntryProfileCount.hasValue() && 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<int> B) { - return B ? std::min(A, *B) : A; + return B ? std::min(A, B.getValue()) : A; }; // return max(A, B) if B is valid. auto MaxIfValid = [](int A, Optional<int> B) { - return B ? std::max(A, *B) : A; + return B ? std::max(A, B.getValue()) : A; }; // Various bonus percentages. These are multiplied by Threshold to get the |