[all-commits] [llvm/llvm-project] 6cdca9: [SCEV] Use no-self-wrap flags infered from exit st...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Sep 7 17:01:02 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cdca906c79fb4e0eae940f11d585c1b08358104
      https://github.com/llvm/llvm-project/commit/6cdca906c79fb4e0eae940f11d585c1b08358104
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-09-07 (Tue, 07 Sep 2021)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll

  Log Message:
  -----------
  [SCEV] Use no-self-wrap flags infered from exit structure to compute trip count

The basic problem being solved is that we largely give up when encountering a trip count involving an IV which is not an addrec. We will fall back to the brute force constant eval, but that doesn't have the information about the fact that we can't cycle back through the same set of values.

There's a high level design question of whether this is the right place to handle this, and if not, where that place is. The major alternative here would be to return a conservative upper bound, and then rely on two invocations of indvars to add the facts to the narrow IV, and then reconstruct SCEV. (I have not implemented the alternative and am not 100% sure this would work out.) That's arguably more in line with existing code, but I find this substantially easier to reason about.  During review, no one expressed a strong opinion, so we went with this one.

Differential Revision: D108651




More information about the All-commits mailing list