Skip to content

Commit 62067bf

Browse files
committed
LU, LV: elaborate on comment for overflows
1 parent 3edbef3 commit 62067bf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/include/llvm/Transforms/Utils/LoopUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
319319
/// In addition if \p EstimatedLoopInvocationWeight is not null it is
320320
/// initialized with weight of loop's latch leading to the exit.
321321
/// Returns a valid positive trip count, or std::nullopt when a meaningful
322-
/// estimate cannot be made.
322+
/// estimate cannot be made (including when the trip count would overflow).
323323
std::optional<unsigned>
324324
getLoopEstimatedTripCount(Loop *L,
325325
unsigned *EstimatedLoopInvocationWeight = nullptr);

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,9 @@ static bool hasIrregularType(Type *Ty, const DataLayout &DL) {
422422
}
423423

424424
/// Returns "best known" trip count, which is either a valid positive trip count
425-
/// or std::nullopt, for the specified loop \p L as defined by the following
426-
/// procedure:
425+
/// or std::nullopt when an estimate cannot be made (including when the trip
426+
/// count would overflow), for the specified loop \p L as defined by the
427+
/// following procedure:
427428
/// 1) Returns exact trip count if it is known.
428429
/// 2) Returns expected trip count according to profile data if any.
429430
/// 3) Returns upper bound estimate if known, and if \p CanUseConstantMax.

0 commit comments

Comments
 (0)