diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index ec1692a..42c70d2 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -843,9 +843,9 @@ static std::optional<unsigned> getEstimatedTripCount(BranchInst *ExitingBranch, // edge exiting the loop, rounded to nearest. uint64_t ExitCount = llvm::divideNearest(LoopWeight, ExitWeight); - // When ExitCount + 1 would wrap in unsigned, return std::nullopt instead. + // When ExitCount + 1 would wrap in unsigned, saturate at UINT_MAX. if (ExitCount >= std::numeric_limits<unsigned>::max()) - return std::nullopt; + return std::numeric_limits<unsigned>::max(); // Estimated trip count is one plus estimated exit count. return ExitCount + 1; |