On Tue, Jul 28, 2015 at 7:12 PM, Uday Khedker <u...@cse.iitb.ac.in> wrote:
>
> On 07/28/2015 08:10 PM, Richard Biener wrote:
>>
>> On July 28, 2015 4:37:15 PM GMT+02:00, "Uday P. Khedker"
>> <u...@cse.iitb.ac.in> wrote:
>>>
>>>
>>> Richard Biener wrote on Tuesday 28 July 2015 01:12 PM:
>>>>
>>>> On Mon, Jul 27, 2015 at 7:14 PM, Uday Khedker <u...@cse.iitb.ac.in>
>>>
>>> wrote:
>>>>>
>>>>> We have added a new field (bool ptr_arith in struct tree_base) to
>>>
>>> the tree
>>>>>
>>>>> node. We are assigning values to this field in a gimple pass in
>>>
>>> non-LTO mode
>>>>>
>>>>> and would like to access them in LTO mode in our ipa passes. It
>>>
>>> appears that
>>>>>
>>>>> all fields of tree node are not preserved in LTO mode. Is there any
>>>
>>> way to
>>>>>
>>>>> tell GCC that a given field should be preserved so that it can be
>>>
>>> accessed
>>>>>
>>>>> in LTO mode?
>>>>
>>>> You have to explicitely add the streaming to tree-streamer-{in,out}.c
>>>>
>>>>
>>> Thanks for this info. We have done the following:
>>>
>>> (a) Added a field to tree_base in the file tree.h as follows:
>>>
>>>        unsigned ptr_arith : 1;
>>>
>>>       right after
>>>
>>>        ENUM_BITFIELD(tree_code) code : 16;
>>>
>>> (b) Added the following code to function  pack_ts_base_value_fields in
>>> the file tree-streamer-out.c
>>>
>>>         bp_pack_value (bp, TREE_PTR_ARITH (expr), 1);
>>>
>>>        just after
>>>
>>>         bp_pack_value (bp, TREE_CODE (expr), 16);
>>>
>>>         Macro TREE_PTR_ARITH access the field pts_arith.
>>>
>>> (c) Added the following code to function unpack_ts_base_value_fields in
>>> the file tree-streamer-in.c
>>>
>>>         TREE_PTR_ARITH (expr) = (unsigned) bp_unpack_value (bp, 1);
>>>
>>>        right in the beginning.
>>>
>>> We are getting the correct values in non-LTO mode of our pass. However,
>>> the same code has values 0 in the LTO mode execution.
>>>
>>> Is there anything else that we need to do? We briefly looked at the
>>> functions in tree-streamer-{in,out}.c but could not guess if something
>>> more needs to be done
>>
>> No, that should be all.  Though dependent on what trees the flags are on
>> you might want to change the tree compare function in lto.c as well.
>>
>> Are you sure the trees survive until lto streaming?
>>
>
> The trees survive because all other fields show correct values. Only the new
> flag remains 0.
>
> Our flag is present in the tree unconditionally. We have written a pass
> which sets this flag conditionally for a tree that involves a pointer
> arithmetic (default value is 0).
>
> Which comparison function are you referring to? There is a function
> lto_splay_tree_compare_ids in lto.c. Is there any other function that we are
> missing?
>
> If it matters: We are using gcc-4.7.2 and using the option
> -flto-partition=none.

Ugh.  I don't remember the details in gcc 4.7 - the way streaming works has
completely changed since then (well, the basics are still in
tree-streamer-{in,out}.c)

So you are on your own debugging where the info gets lost.  Did you try setting
breakpoints on the streaming of your flag or add printfs?

Richard.

> Uday.
>
>

Reply via email to