Skip to content

Commit cd16c70

Browse files
authored
[IRCE] Use function_ref<> instead of optional<function_ref<>> (NFC) (#151308)
llvm::function_ref<> is nullable.
1 parent 10b323b commit cd16c70

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ class InductiveRangeCheckElimination {
237237
DominatorTree &DT;
238238
LoopInfo &LI;
239239

240-
using GetBFIFunc =
241-
std::optional<llvm::function_ref<llvm::BlockFrequencyInfo &()>>;
240+
using GetBFIFunc = llvm::function_ref<llvm::BlockFrequencyInfo &()>;
242241
GetBFIFunc GetBFI;
243242

244243
// Returns the estimated number of iterations based on block frequency info if
@@ -249,7 +248,7 @@ class InductiveRangeCheckElimination {
249248
public:
250249
InductiveRangeCheckElimination(ScalarEvolution &SE,
251250
BranchProbabilityInfo *BPI, DominatorTree &DT,
252-
LoopInfo &LI, GetBFIFunc GetBFI = std::nullopt)
251+
LoopInfo &LI, GetBFIFunc GetBFI = nullptr)
253252
: SE(SE), BPI(BPI), DT(DT), LI(LI), GetBFI(GetBFI) {}
254253

255254
bool run(Loop *L, function_ref<void(Loop *, bool)> LPMAddNewLoop);
@@ -959,7 +958,7 @@ PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
959958
std::optional<uint64_t>
960959
InductiveRangeCheckElimination::estimatedTripCount(const Loop &L) {
961960
if (GetBFI) {
962-
BlockFrequencyInfo &BFI = (*GetBFI)();
961+
BlockFrequencyInfo &BFI = GetBFI();
963962
uint64_t hFreq = BFI.getBlockFreq(L.getHeader()).getFrequency();
964963
uint64_t phFreq = BFI.getBlockFreq(L.getLoopPreheader()).getFrequency();
965964
if (phFreq == 0 || hFreq == 0)

0 commit comments

Comments
 (0)