[PATCH] D71990: [LoopUtils] Better accuracy for getLoopEstimatedTripCount.

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 02:17:24 PST 2020


ebrevnov marked 2 inline comments as done.
ebrevnov added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:726
   if (!LatchCycleWeight || !LatchExitWeight)
     return 0;
 
----------------
Ayal wrote:
> If !LatchCycleWeight (if !BackedgeTakenWeight) it should return 1 instead of 0. I.e., should always be equal to "getEstimateBackedgeTakenCount()" plus 1.
> 
> If !LatchExitWeight, perhaps better return None instead of 0? This implies the loop was never entered when gathering the profile, or loop was entered once and never exited(?); in either case estimating the trip count to be zero seems wrong.
Completely agree.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71990/new/

https://reviews.llvm.org/D71990





More information about the llvm-commits mailing list