[llvm] LV: reuse getSmallBestKnownTC in a TC estimation (NFC) (PR #105834)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 29 12:30:24 PDT 2024
================
@@ -1971,14 +1971,9 @@ class GeneratedRTChecks {
// count. Assume that the outer loop executes at least twice.
unsigned BestTripCount = 2;
- // If exact trip count is known use that.
- if (unsigned SmallTC = SE->getSmallConstantTripCount(OuterLoop))
- BestTripCount = SmallTC;
- else if (LoopVectorizeWithBlockFrequency) {
- // Else use profile data if available.
- if (auto EstimatedTC = getLoopEstimatedTripCount(OuterLoop))
- BestTripCount = *EstimatedTC;
- }
+ // Get the best known TC estimate.
+ if (auto EstimatedTC = getSmallBestKnownTC(*SE, OuterLoop))
----------------
fhahn wrote:
Yes, returning the max trip count here would probably severely overestimate the trip count. I *think* some of the existing callers probably should also be updated to avoid using the constant max, especially if it is very large (.e.g -1)
Would be good to have a test that shows the difference between using ` /* CanUseConstantMax=*/false` and ` /* CanUseConstantMax=*/true`
https://github.com/llvm/llvm-project/pull/105834
More information about the llvm-commits
mailing list