aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Maxwell <benjamin.maxwell@arm.com>2025-07-31 07:56:05 +0100
committerGitHub <noreply@github.com>2025-07-31 07:56:05 +0100
commitcd16c706ba245c1eeafdacf89e4837a57efe8a2d (patch)
treed8532e671b1b04b884f3fa155ca5355eb7bbb01a
parent10b323b993f4f43a382c6444dfe6e4c0fda15ab2 (diff)
downloadllvm-cd16c706ba245c1eeafdacf89e4837a57efe8a2d.zip
llvm-cd16c706ba245c1eeafdacf89e4837a57efe8a2d.tar.gz
llvm-cd16c706ba245c1eeafdacf89e4837a57efe8a2d.tar.bz2
[IRCE] Use function_ref<> instead of optional<function_ref<>> (NFC) (#151308)
llvm::function_ref<> is nullable.
-rw-r--r--llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index e706a6f..deff79b 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -237,8 +237,7 @@ class InductiveRangeCheckElimination {
DominatorTree &DT;
LoopInfo &LI;
- using GetBFIFunc =
- std::optional<llvm::function_ref<llvm::BlockFrequencyInfo &()>>;
+ using GetBFIFunc = llvm::function_ref<llvm::BlockFrequencyInfo &()>;
GetBFIFunc GetBFI;
// Returns the estimated number of iterations based on block frequency info if
@@ -249,7 +248,7 @@ class InductiveRangeCheckElimination {
public:
InductiveRangeCheckElimination(ScalarEvolution &SE,
BranchProbabilityInfo *BPI, DominatorTree &DT,
- LoopInfo &LI, GetBFIFunc GetBFI = std::nullopt)
+ LoopInfo &LI, GetBFIFunc GetBFI = nullptr)
: SE(SE), BPI(BPI), DT(DT), LI(LI), GetBFI(GetBFI) {}
bool run(Loop *L, function_ref<void(Loop *, bool)> LPMAddNewLoop);
@@ -959,7 +958,7 @@ PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
std::optional<uint64_t>
InductiveRangeCheckElimination::estimatedTripCount(const Loop &L) {
if (GetBFI) {
- BlockFrequencyInfo &BFI = (*GetBFI)();
+ BlockFrequencyInfo &BFI = GetBFI();
uint64_t hFreq = BFI.getBlockFreq(L.getHeader()).getFrequency();
uint64_t phFreq = BFI.getBlockFreq(L.getLoopPreheader()).getFrequency();
if (phFreq == 0 || hFreq == 0)