On Fri, Sep 21, 2012 at 01:32:25PM +0200, Richard Guenther wrote:

...

> Yes, most of the SRA heuristic games make it complicated and ugly,
> especially as it is isn't clearly separate analysis / decision / transform
> phases.  TLC welcome ;)
> 

While I agree that the heuristics of SRA is surprisingly complex and a
bit ugly (but that's mostly because people complain when it does too
little or too much), the pass it is clearly divided into analysis,
decision, transform phases.  Specifically, unless a variable is
discarded because of things like volatile accesses or complex
overlapping accesses (usually through unions), all SRA decisions about
it are made in analyze_access_subtree.  All code executed before that
just gathers data for that function (yeah, including a gazillion
flags), every code executed afterwards does transformation as it was
decided and specifically cannot change ay decisiond (even when it
bumps into unions, placement new tricks etc., that's the main reason
why the transformation can be quite ugly too).

What I'd try is to create a replacement for (nearly) all roots of
access trees for a single variable (unless of course there is only one
corresponding to the whole variable) - i.e. those that
analyze_access_trees loops over.  A lot of code in the transformation
phase will still need changes but the heuristics should not actually
be a problem.

Martin

Reply via email to