[PATCH] D147910: [IRCE] Relax restrictions on IRCE's latch exit count

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 00:18:58 PDT 2023


mkazantsev created this revision.
mkazantsev added reviewers: reames, skatkov, apilipenko, danilaml, dmakogon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

It seems that existing logic is too strict about latch block exit count.
It is required to be computable, however it is not used in any computations,
and effectively the only thing it is used for is to get the type of computed
exit count.

We could instead use a more relaxed version - max symbolic exit count, which,
if exists, is enough to say that the loop is finite, and its type should be good enough.

I didn't find any subtle dependency on this value and ran a big corps of fuzz tests,
and they didn't reveal any problem. Supposedly we've been too strict without
good reason (and because symbolic exit counts didn't exist when this code was
first introduced).


https://reviews.llvm.org/D147910

Files:
  llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
  llvm/test/Transforms/IRCE/stride_more_than_1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147910.512084.patch
Type: text/x-patch
Size: 6889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230410/121c1533/attachment.bin>


More information about the llvm-commits mailing list