[PATCH] D25607: [SCEV] More accurate calculation of max backedge count of some less-than loops

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 04:20:33 PDT 2016


john.brawn created this revision.
john.brawn added reviewers: sanjoy, christof, haicheng.
john.brawn added a subscriber: llvm-commits.
john.brawn set the repository for this revision to rL LLVM.
Herald added a subscriber: mzolotukhin.

In loops that look something like

  i = n;
  do {
   ...
  } while(i++ < n+k);

where k is a constant, the maximum backedge count is k (in fact the backedge count will be either 0 or k, depending on whether n+k wraps). More generally for LHS < RHS if RHS-(LHS of first comparison) is a constant then the loop will iterate either 0 or that constant number of times.

This allows for more loop unrolling with the recent upper bound loop unrolling changes, and I'm working on a patch that will let loop unrolling additionally make use of the loop being executed either 0 or k times (we need to retain the loop comparison only on the first unrolled iteration).


Repository:
  rL LLVM

https://reviews.llvm.org/D25607

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/trip-count13.ll
  test/Analysis/ScalarEvolution/trip-count14.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25607.74656.patch
Type: text/x-patch
Size: 11759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/686d31b2/attachment.bin>


More information about the llvm-commits mailing list