[PATCH] D89541: [IRCE] Do not transform is loop has small number of iterations

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 02:43:55 PDT 2020


skatkov added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:1903
+  // Profitability check.
+  if (!SkipProfitabilityChecks && GetBFI.hasValue()) {
+    BlockFrequencyInfo &BFI = (*GetBFI)();
----------------
ebrevnov wrote:
> There is an existing utility function inside the vectorizer (getSmallBestKnownTC) which estimates loop's trip count. Can this be used (if made public) instead of BFI?
The utility you mentioned uses SE and BPI on latch only to estimate the trip count.

IRCE has already estimation basing on BPI of latch. It is not enough if the main exit from the loop is not a latch like in the test I've added to this CL.

May be for vectorizer it is ok to be based on latch but not for IRCE.


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

https://reviews.llvm.org/D89541



More information about the llvm-commits mailing list