[PATCH] D91230: [IRCE] Increase min runtime iteration threshold

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 20:49:00 PST 2020


skatkov created this revision.
skatkov added reviewers: mkazantsev, ebrevnov.
Herald added subscribers: dantrushin, hiraditya.
Herald added a project: LLVM.
skatkov requested review of this revision.

In the last change to IRCE the BPI is ignored if BFI is present, however
BFI and BPI have a different thresholds. Specifically BPI approach checks only
latch exit probability so it is expected if the loop has only one exit block (latch)
the behavior with BFI and BPI should be the same,

BPI approach by default uses threshold 10, so it considers the loop with estimated
number of iterations less then 10 should not be considered for IRCE optimization.
BFI approach uses the default value 3 and this is inconsistent.

The CL increases the threshold 3 to 10 for BFI approach.

The test is updated due to it has two side-exits (except latch) and each of them has a
probability 1/16, so BFI estimates the number of runtime iteration is about to 7
(1/16 + 1/16 + some for latch) and test fails.


https://reviews.llvm.org/D91230

Files:
  llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
  llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll


Index: llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll
===================================================================
--- llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll
+++ llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll
@@ -60,4 +60,4 @@
 ; CHECK: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
 
 !0 = !{i32 0, i32 2147483647}
-!1 = !{!"branch_weights", i32 64, i32 4}
+!1 = !{!"branch_weights", i32 128, i32 4}
Index: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -117,7 +117,7 @@
                                              cl::Hidden, cl::init(false));
 
 static cl::opt<unsigned> MinRuntimeIterations("min-runtime-iterations",
-                                              cl::Hidden, cl::init(3));
+                                              cl::Hidden, cl::init(10));
 
 static cl::opt<bool> AllowUnsignedLatchCondition("irce-allow-unsigned-latch",
                                                  cl::Hidden, cl::init(true));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91230.304387.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201111/ef278486/attachment.bin>


More information about the llvm-commits mailing list