forked from OSchip/llvm-project
[clang, llvm] Use Optional::getValueOr (NFC)
This commit is contained in:
parent
4db2e4cebe
commit
c8b1ed5fb2
|
@ -553,7 +553,7 @@ public:
|
|||
|
||||
/// Return true if the diagnostic piece is prunable.
|
||||
bool isPrunable() const {
|
||||
return IsPrunable.hasValue() ? IsPrunable.getValue() : false;
|
||||
return IsPrunable.getValueOr(false);
|
||||
}
|
||||
|
||||
void dump() const override;
|
||||
|
|
|
@ -170,11 +170,11 @@ public:
|
|||
uint64_t getOrCompColdCountThreshold() const;
|
||||
/// Returns HotCountThreshold if set.
|
||||
uint64_t getHotCountThreshold() const {
|
||||
return HotCountThreshold ? HotCountThreshold.getValue() : 0;
|
||||
return HotCountThreshold.getValueOr(0);
|
||||
}
|
||||
/// Returns ColdCountThreshold if set.
|
||||
uint64_t getColdCountThreshold() const {
|
||||
return ColdCountThreshold ? ColdCountThreshold.getValue() : 0;
|
||||
return ColdCountThreshold.getValueOr(0);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -316,11 +316,11 @@ bool ProfileSummaryInfo::isColdCountNthPercentile(int PercentileCutoff,
|
|||
}
|
||||
|
||||
uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold() const {
|
||||
return HotCountThreshold ? HotCountThreshold.getValue() : UINT64_MAX;
|
||||
return HotCountThreshold.getValueOr(UINT64_MAX);
|
||||
}
|
||||
|
||||
uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() const {
|
||||
return ColdCountThreshold ? ColdCountThreshold.getValue() : 0;
|
||||
return ColdCountThreshold.getValueOr(0);
|
||||
}
|
||||
|
||||
bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB,
|
||||
|
|
|
@ -441,9 +441,7 @@ PartialInlinerImpl::computeOutliningColdRegionsInfo(
|
|||
};
|
||||
|
||||
auto BBProfileCount = [BFI](BasicBlock *BB) {
|
||||
return BFI->getBlockProfileCount(BB)
|
||||
? BFI->getBlockProfileCount(BB).getValue()
|
||||
: 0;
|
||||
return BFI->getBlockProfileCount(BB).getValueOr(0);
|
||||
};
|
||||
|
||||
// Use the same computeBBInlineCost function to compute the cost savings of
|
||||
|
|
|
@ -415,9 +415,7 @@ void PseudoProbeUpdatePass::runOnFunction(Function &F,
|
|||
FunctionAnalysisManager &FAM) {
|
||||
BlockFrequencyInfo &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
|
||||
auto BBProfileCount = [&BFI](BasicBlock *BB) {
|
||||
return BFI.getBlockProfileCount(BB)
|
||||
? BFI.getBlockProfileCount(BB).getValue()
|
||||
: 0;
|
||||
return BFI.getBlockProfileCount(BB).getValueOr(0);
|
||||
};
|
||||
|
||||
// Collect the sum of execution weight for each probe.
|
||||
|
|
|
@ -1752,7 +1752,7 @@ void CHR::transformScopes(CHRScope *Scope, DenseSet<PHINode *> &TrivialPHIs) {
|
|||
// Create the combined branch condition and constant-fold the branches/selects
|
||||
// in the hot path.
|
||||
fixupBranchesAndSelects(Scope, PreEntryBlock, MergedBr,
|
||||
ProfileCount ? ProfileCount.getValue() : 0);
|
||||
ProfileCount.getValueOr(0));
|
||||
}
|
||||
|
||||
// A helper for transformScopes. Clone the blocks in the scope (excluding the
|
||||
|
|
Loading…
Reference in New Issue