>>> On 10.12.15 at 14:53, <bschm...@redhat.com> wrote:
> On 12/10/2015 01:38 PM, Jan Beulich wrote:
>> --- 2015-12-09/gcc/cfgexpand.c
>> +++ 2015-12-09/gcc/cfgexpand.c
>> @@ -1544,12 +1544,15 @@ static HOST_WIDE_INT
>>   expand_one_var (tree var, bool toplevel, bool really_expand)
>>   {
>>     unsigned int align = BITS_PER_UNIT;
>> +  bool stack = true;
>>     tree origvar = var;
>>
>>     var = SSAVAR (var);
>>
>>     if (TREE_TYPE (var) != error_mark_node && TREE_CODE (var) == VAR_DECL)
>>       {
>> +      stack = !TREE_STATIC (var) && !DECL_EXTERNAL (var);
>> +
>>         /* Because we don't know if VAR will be in register or on stack,
>>       we conservatively assume it will be on stack even if VAR is
>>       eventually put into register after RA pass.  For non-automatic
>> @@ -1578,7 +1581,8 @@ expand_one_var (tree var, bool toplevel,
>>      align = POINTER_SIZE;
>>       }
>>
>> -  record_alignment_for_reg_var (align);
>> +  if (stack)
>> +    record_alignment_for_reg_var (align);
> 
> A bit further down we have
> 
>    else if (DECL_EXTERNAL (var))
>      ;
>    else if (DECL_HAS_VALUE_EXPR_P (var))
>      ;
>    else if (TREE_STATIC (var))
>      ;
> [....]
>    return 0;
> 
> so I'm thinking the function doesn't do anything for DECL_EXTERNAL or 
> TREE_STATIC vars. You're still computing alignment for them but not 
> using it. I suggest just doing an early return for non-stack vars.

If not reaching

  if (TREE_CODE (origvar) == SSA_NAME)
    {
      gcc_assert (TREE_CODE (var) != VAR_DECL
                  || (!DECL_EXTERNAL (var)
                      && !DECL_HAS_VALUE_EXPR_P (var)
                      && !TREE_STATIC (var)
                      && TREE_TYPE (var) != error_mark_node
                      && !DECL_HARD_REGISTER (var)
                      && really_expand));
    }

in that case is not a problem, this would make for even simpler a
change. Please let me know.

Jan

Reply via email to