diff options
author | Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com> | 2025-03-04 08:43:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-04 08:43:08 +0000 |
commit | 80bdfcd411cd8197b0a8b6139b89a87d3a4528fa (patch) | |
tree | a24c9065fa4d698a257bf1228c58733e6e625eaa /clang/test/AST/ast-print-openacc-declare-construct.cpp | |
parent | 23a30e68888e764b2f4d32e51d415b50fa5f5cac (diff) | |
download | llvm-80bdfcd411cd8197b0a8b6139b89a87d3a4528fa.zip llvm-80bdfcd411cd8197b0a8b6139b89a87d3a4528fa.tar.gz llvm-80bdfcd411cd8197b0a8b6139b89a87d3a4528fa.tar.bz2 |
[LoopUtils] Don't wrap in getLoopEstimatedTripCount (#129080)
getLoopEstimatedTripCount returns the trip count based on profiling
data, and its documentation says that it could return 0 when the trip
count is zero, but this is not the case: a valid trip count can never be
zero, and it returns 0 when the unsigned ExitCount is incremented by 1
and wraps. Some callers are careful about checking for this zero value
in an std::optional, but it makes for an API with footguns, as a
std::optional return value indicates that a non-nullopt value would be a
valid trip count. Fix this by explicitly returning std::nullopt when the
return value would wrap, and strip additional checks in callers. This
also fixes a minor bug in LoopVectorize.
Diffstat (limited to 'clang/test/AST/ast-print-openacc-declare-construct.cpp')
0 files changed, 0 insertions, 0 deletions