This seems to be the way the rest of ira-color.c does it. I hope it's OK. It does fix the segfault.
2019-09-10 Maya Rashish <co...@sdf.org> PR target/85401 * ira-color.c: (allocno_copy_cost_saving) Call ira_init_register_move_cost_if_necessary
diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 99236994d64..5d721102e19 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -2828,6 +2828,7 @@ allocno_copy_cost_saving (ira_allocno_t allocno, int hard_regno) } else gcc_unreachable (); + ira_init_register_move_cost_if_necessary(allocno_mode); cost += cp->freq * ira_register_move_cost[allocno_mode][rclass][rclass]; } return cost;