On 1/25/19 7:59 PM, Jan Hubicka wrote:
>> Hi.
>>
>> The patch puts back ::get_create for a node that can be seen first time.
>> It's due to -O0 optimize attribute. It was unable to write properly
>> LTO test-case for it.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2019-01-18  Martin Liska  <mli...@suse.cz>
>>
>>      PR lto/88876
>>      * ipa-pure-const.c (propagate_pure_const): Revert hunk as
>>      we need default values of funct_state for a function that
>>      is not optimized.
> 
> I think you want to test if y enables pure_const prior calling get
> becuase get_create will just create empty info that will likely have
> IPA_CONST (which is 0) and not IPA_NEITHER.

No, it creates proper state:

  funct_state_d (): pure_const_state (IPA_NEITHER),
    state_previously_known (IPA_NEITHER), looping_previously_known (true),
    looping (true), can_throw (true), can_free (true),
    malloc_state (STATE_MALLOC_BOTTOM) {}

Note that working with funct_state_d fields is quite complex and if you
want to not call get_create, then I would leave the patch to you :)

Martin

There are multiple copies
> of this code in other propagators and I think they all needs to check if
> the pass is enabled for particular symbol and if not resort to
> propagating nothing.
> 
> Honza
>> ---
>>  gcc/ipa-pure-const.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>>
> 
>> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
>> index 8227eed29bc..b8fd08c0a7e 100644
>> --- a/gcc/ipa-pure-const.c
>> +++ b/gcc/ipa-pure-const.c
>> @@ -1498,7 +1498,8 @@ propagate_pure_const (void)
>>              }
>>            if (avail > AVAIL_INTERPOSABLE)
>>              {
>> -              funct_state y_l = funct_state_summaries->get (y);
>> +              funct_state y_l = funct_state_summaries->get_create (y);
>> +
>>                if (dump_file && (dump_flags & TDF_DETAILS))
>>                  {
>>                    fprintf (dump_file,
>>
> 

Reply via email to