[PATCH] D114650: [SCEV] Construct SCEV iteratively (WIP).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 12:54:22 PST 2021


fhahn added a comment.

In D114650#3159649 <https://reviews.llvm.org/D114650#3159649>, @reames wrote:

> I want to make sure I understand the problem to be solved.  The description and discussion confused me a bit, so I may in fact be wildly off here.
>
> Is the basis issue being solved that calling createSCEV on some IR instruction can require recursing through a very deep chain of instructions which have not yet had SCEVs formed for them?  More specifically, is that the *only* deep recursion we're concerned by?  The discussion about new invariants for creating a SCEV seemed to indicate it might be much wider, but that discussion didn't parse for me.

Yes, this is the main issue I'd like to address with this change, thanks for summarising this concisely!

> If my understanding is correct, then I would have expected this to be effectively a change strictly inside createSCEV.  The fact we seem to be changing things much more broadly confuses me.  Maybe there's some complexity coming from the phi handling, but if so, maybe a first patch which *only* iteratively constructs arithmetic chains and relies on recursion for the tricky phi parts?

I think most of the 'cluttering' changes are `getSCEV -> getExistingSCEV`. Those are not strictly necessary and I should be able to strip those from the initial version, same for excluding the phi part.

The `getSCEV -> getExistingSCEV` changes are related to the invariant mentioned: if we iteratively construct the operands first, then we should be able to rely on the fact that SCEVs for all operands exist when construction a new SCEV, hence using `getExistingSCEV` instead of `getSCEV`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114650



More information about the llvm-commits mailing list