[PATCH] D110620: [SCEV] Infer ranges for SCC consisting of cycled Phis

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 02:51:34 PDT 2021


mkazantsev added a comment.

In D110620#3030883 <https://reviews.llvm.org/D110620#3030883>, @reames wrote:

> Seems overall reasonable, though, I'm curious, where do you see this trigger in practice?  Given this formulation doesn't involve anything but phis, it disallows IVs.  Given that, I'm curious what patterns create this.

It's the first step. I'm planning to generalize this to deal with chunked IV.

Imagine we had a single block loop which was incrementing. Everything was fine, and SCEV knew how to deal with its range.

Then we chunked the iteration space is split in chunks, and we have two loops, outer phi being start for inner phi, and taking it as backedge input.

SCEV in this case becomes just helpless to do anything. It cannot even prove they are non-negative if they start from 0 and only go up. The thing I am aiming is SCC's consisting of SCEVUnknowns and SCEVAddReds<nuw>/<nsw>. Idea is following: if a SCC only takes non-negative values from outside, and all its addrecs have nuw/nsw, then the entire thing is non-negative.

Examples of this I've merged as `test/Transforms/IndVarSimplify/outer_phi.ll`.

But this is a bit far-fetched. As a first step I wanted to fix case with cycled Phis, whether they are chunked IV or they are just siblings or whatever.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110620/new/

https://reviews.llvm.org/D110620



More information about the llvm-commits mailing list