[PATCH] D89773: [IRCE] consolidate profitability check

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 02:40:42 PDT 2020


ebrevnov accepted this revision.
ebrevnov added a comment.
This revision is now accepted and ready to land.

LGTM with a nit.



================
Comment at: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:1929
   LoopStructure LS = MaybeLoopStructure.getValue();
-  // Profitability check.
-  if (!SkipProfitabilityChecks && GetBFI.hasValue()) {
-    BlockFrequencyInfo &BFI = (*GetBFI)();
-    uint64_t hFreq = BFI.getBlockFreq(LS.Header).getFrequency();
-    uint64_t phFreq = BFI.getBlockFreq(Preheader).getFrequency();
-    if (phFreq != 0 && hFreq != 0 && (hFreq / phFreq < MinRuntimeIterations)) {
-      LLVM_DEBUG(dbgs() << "irce: could not prove profitability: "
-                        << "the estimated number of iterations basing on "
-                           "frequency info is " << (hFreq / phFreq) << "\n";);
-      return false;
-    }
-  }
+  if (!checkProfitability(*L, LS.LatchBrExitIdx))
+    return false;
----------------
IMHO, it would be a bit cleaner API if we pass 'LS' and retrieve required info from it inside checkProfitability.


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

https://reviews.llvm.org/D89773



More information about the llvm-commits mailing list