[PATCH] D44677: [SCEV] Make computeExitLimit more simple and more powerful

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 03:53:04 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: sanjoy, apilipenko, anna, skatkov, reames.
mkazantsev added a dependency: D44676: [SCEV] Make exact taken count calculation more optimistic.

Current implementation of `computeExitLimit` has a big piece of code
the only purpose of which is to prove that after the execution of this
block the latch will be executed. What it currently checks is actually a
subset of situations where the exiting block dominates latch.

This patch replaces all these checks for simple particular cases with
domination check over loop's latch which is the only necessary condition
of taking the exiting block into consideration. This change allows to
calculate exact loop taken count for simple loops like

  for (int i = 0; i < 100; i++) {
    if (cond) {...} else {...}
    if (i > 50) break;
    . . .
  }


https://reviews.llvm.org/D44677

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/exact_iter_count.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44677.139098.patch
Type: text/x-patch
Size: 4809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180320/a53fc7d3/attachment.bin>


More information about the llvm-commits mailing list