Possible IRA bug in assign_hard_reg

Vladimir Makarov vmakarov@redhat.com
Thu Jan 21 21:07:00 GMT 2010


Ian Bolton wrote:
> Near the end of assign_hard_reg in ira-color.c, there is this code:
>
>
> if (min_full_cost > mem_cost)
>   {
>     if (! retry_p && internal_flag_ira_verbose > 3 && ira_dump_file !=
> NULL)
> 	fprintf (ira_dump_file, "(memory is more profitable %d vs %d) ",
> 		 mem_cost, min_full_cost);
>     best_hard_regno = -1;
>   }
>
>
> If retry_p is true then we are in reload, so I wouldn't expect us to
> override best_hard_regno in this case.  I think the code should read:
>
>
> if (min_full_cost > mem_cost && ! retry_p)
>   {
>     if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
> 	fprintf (ira_dump_file, "(memory is more profitable %d vs %d) ",
> 		 mem_cost, min_full_cost);
>     best_hard_regno = -1;
>   }
>
>
> I'm probably wrong, but I wanted to check.
>
>   
The original code is ok, I think.

First, retry_p is true not only from reload.  It is true when we are 
trying to assign hard register after IR flattening during which new 
allocnos can be created to resolve cycles for register shuffling on 
region borders.

If memory is more profitable we should use independently from where we 
call assign_hard_reg.

Retry_p is used as guard for dump printing because it is a part of dump 
when allocno is popped from coloring  stack (in this case retry_p is false).



More information about the Gcc mailing list