On Wed, Sep 19, 2012 at 01:36:50PM +0200, Richard Guenther wrote: > On Wed, Sep 19, 2012 at 12:58 PM, Eric Botcazou <ebotca...@adacore.com> wrote: > I really don't like this to be done outside of SRA (and it is written in a > non-MEM_REF way). For the testcase in question we scalarize back > 'i' in SRA (other scalars are optimized away already, but as SRA runs > before DSE it still gets to see stores to FRAME.i). Now I wonder > why we generate reasonable debug info even without inlining, > thus there has to be a association to the original decls with > the frame FIELD_DECLs. That is, lookup_decl_for_field should not be necessary > and what we use for debug info generation should be used by SRA > to assign a name to scalarized fields.
For debug_info, the nested function has VAR_DECLs with DECL_VALUE_EXPR as FIELD_DECLs of the chain. > That alone would not solve your issue because of the 'arr' field in > the structure which cannot be scalarized (moved to a stand-alone > decl) by SRA. That's one missed feature of SRA though, and generally > useful. I agree that SRA is the right approach for this, perhaps with the DECL_NONLOCAL_FRAME bit used by SRA to forcefully scalarize it into individual pieces (that bit should basically tell the scalarizer that valid code can't use pointer arithmetics to go from one outermost field to another outermost field, i.e. those can be safely split appart even if the whole thing is address taken). Jakub