[IRCE] Use the same min runtime iteration threshold for BPI and BFI checks
authorSerguei Katkov <serguei.katkov@azul.com>
Tue, 10 Nov 2020 04:30:56 +0000 (11:30 +0700)
committerSerguei Katkov <serguei.katkov@azul.com>
Mon, 16 Nov 2020 02:21:50 +0000 (09:21 +0700)
commit400f6edce7541e071afe18e40cca745a672e84dc
tree213570dd7dfa235921c2af44dc9680e0b465203d
parentc22dc71b120b066c0066b8517014149a001cc2b0
[IRCE] Use the same min runtime iteration threshold for BPI and BFI checks

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 modifies the code to use the same threshold for both approaches..

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.

Reviewers: mkazantsev, ebrevnov
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D91230
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
llvm/test/Transforms/IRCE/low-iterations.ll
llvm/test/Transforms/IRCE/multiple-access-no-preloop.ll