[PATCH] D79036: [SCCP] Switch to widen at PHIs, stores and call edges.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 10:56:19 PDT 2020


fhahn added a comment.

In D79036#2058944 <https://reviews.llvm.org/D79036#2058944>, @efriedma wrote:

> I guess I'll start by stepping back to state the fundamental issue here: constant ranges introduce way to many intermediate states, so the algorithm doesn't converge in a reasonable amount of time.  To deal with this, you have to skip some steps: force values to overdefined, or maybe a substantially wider constantrange.  There are a few different ways you could do this:
>
> 1. Some sort of global counter: after N steps, anything still in the worklist goes straight to overdefined.
> 2. Detect specific cycles: for example, if you have a loop induction variable, compute the range based on the trip count of the loop.
> 3. What you're doing here: add a counter to each join point.  It's impossible to loop without a join point, so you'll catch any arithmetic loops.
> 4. Add a counter to arithmetic operations.
> 5. Probably some other approaches I haven't thought of.
>
>   All of these can potentially work together: you can take the intersection of multiple approaches.
>
>   My intuition is that detecting specific cycles is going to be a lot more effective than iteratively widening, in terms of finding optimization opportunities.  But detecting cycles is hard to do reliably, so we probably want some iterative limit anyway.


Thanks for the great summary Eli! There are definitely plenty of additional avenues to explore.

On a related note I think the top-level comments in SCCP.cpp are now quite out of date. I'll try to update them to reflect the current state more accurately soonish.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79036





More information about the llvm-commits mailing list