[PR target/85401] initialize the move cost table before using it (in another place, too)

coypu@sdf.org coypu@sdf.org
Fri Oct 4 13:23:00 GMT 2019


On Tue, Oct 01, 2019 at 01:26:16PM -0600, Jeff Law wrote:
> On 9/30/19 2:45 PM, coypu@sdf.org wrote:
> > On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
> >> Yes, the patch is mostly ok.  You can commit it into the trunk after
> >> applying changes mentioned below. If you do not have a write access, let me
> >> know I'll commit the patch by myself.
> > 
> > I don't have commit access. It would be nice if you committed it :)
> I took care of the nits and committed the patch.
> 
> 
> > 
> >> It would be nice to add a small test too.  But it is not obligatory for this
> >> case as the patch is obvious and it might be hard to create a small test to
> >> reproduce the bug.
> > 
> > I have the C code that produces this failure. I can creduce it, but I'm
> > not sure there's a relationship between it and the bug.
> > Doing unrelated changes (adding instruction scheduling) to vax also hid it.
> > 
> > Is this kind of test still valuable?
> Often they are.
> 
> jeff

So it was. Here's another missed initialization, that running creduce
accidentally reached.



The mode might have changed, let's make sure the new mode is initialized
too.

2019-10-04	Maya Rashish <coypu@sdf.org>
	* ira-color.c (update_costs_from_allocno): Call
	ira_init_register_move_cost_if_necessary.

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 505d5c8ffb3..fb8b4dbc652 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1372,6 +1372,7 @@ update_costs_from_allocno (ira_allocno_t allocno, int hard_regno,
 	     e.g. DImode for AREG on x86.  For such cases the
 	     register move cost will be maximal.  */
 	  mode = narrower_subreg_mode (mode, ALLOCNO_MODE (cp->second));
+	  ira_init_register_move_cost_if_necessary (mode);
 	  
 	  cost = (cp->second == allocno
 		  ? ira_register_move_cost[mode][rclass][aclass]



More information about the Gcc-patches mailing list