[VTA, PR41473] drop NULL locations from lists

Alexandre Oliva aoliva@redhat.com
Tue Nov 24 02:40:00 GMT 2009


On Nov 23, 2009, Cary Coutant <ccoutant@google.com> wrote:

> Jakub wrote:
>>> Are you sure the dropping of single_element_loc_list call in the
>>> loc-> first && loc->last == loc->first case is a good idea?

It wasn't.  I didn't realize it was needed for the block-form
optimization to work.  However, I think the optimization is a bit
excessive.  We don't want to say a variable is at a certain location
throughout its lifetime just because it happens to be there on a narrow
range of PCs.

> And I replied:
>> I don't think that would mean the same thing: a single-element loc
>> list describes a variable whose value is known only for that one
>> range, where a block form location expression describes a variable
>> that can always be found at the given location.

> Hmmm, it looks like add_AT_location_description() is already going to
> convert single-element loc lists into a simple block-form location
> expression. In the case of a single-element location list where the
> range is constrained, is that really the right thing to do?

If there aren't any other entries, we could probably assume they're
equivalent, i.e., that the variable is set when we enter its scope, and
remains live till the end.  This may not always hold, though: if the
variable is set later in the scope, we lose.

Nevertheless, I've (partially) restored this functionality in the patch
below.  It retains var_loc_notes with NULL locs until the time of
converting lists to the internal dwarf representation, and then it only
applies the optimization if there's really no more than a single entry
in the incoming location list.

I've also fixed an assertion check I ran into on
x86_64-linux-gnu/libgcc: a VOIDmode CONST_DOUBLE failed the mode ==
GET_MODE newly-introduced assertion, so I realized it to accept incoming
non-VOID modes with VOIDmode consts.

This one has passed bootstrap compare on x86_64-linux-gnu already,
building target libs now.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vta-dwarf2out-omit-empty-loc-pr41473.patch
Type: text/x-diff
Size: 12347 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091124/d88aba72/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


More information about the Gcc-patches mailing list