On Mon, Dec 10, 2012 at 10:55 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Well ... I would have expected that we'd have folded the CONST_DECL to >> its DECL_INITIAL. At least that is what we do for all other CONST_DECLs. >> The only way CONST_DECLs should appear in the IL (after some optimization >> of course) is when you take their address. > > That's what (essentially) happens here. The CONST_DECL is wrapped up in a > VIEW_CONVERT_EXPR to array type and a component with non-constant index is > extracted from it.
Ah, ok ... >> So - if you can burn some extra cycles to figure out why it's not >> replaced by its DECL_INITIAL ...? > > We specifically prevent that in gigi because it will need to be spilled to > memory given the above access pattern, so I don't really see the problem. > Here's the access in .optimized: > > _38 = MEM[symbol: pkg__zero_unit, index: ivtmp.38_27, step: 4, offset: -4B]; ... so if would really be a pessimization doing that. Of course handling CONST_DECL in for_each_index is indeed obvious - I just was curios if it was a missed-optimization opportunity as well. Thanks for clarifying, Richard. > -- > Eric Botcazou