diff options
author | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-31 17:51:13 +0000 |
---|---|---|
committer | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-03-31 17:51:13 +0000 |
commit | 4dd26fcc32406dc5af8a070fcc468251fe5204f6 (patch) | |
tree | 7801a3c0df05c7f60695ebbe68fb59e31da15483 /gcc/ira-color.c | |
parent | 464a46fe05fc74069be0374aa0667a2ff9cab533 (diff) | |
download | gcc-4dd26fcc32406dc5af8a070fcc468251fe5204f6.tar.gz |
2016-03-31 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/70461
* ira-color.c (allocno_copy_cost_saving): Use allocno class if it
is necessary.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234649 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-color.c')
-rw-r--r-- | gcc/ira-color.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ira-color.c b/gcc/ira-color.c index fba8da4bd4f..84334791e2a 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -2734,10 +2734,16 @@ static int allocno_copy_cost_saving (ira_allocno_t allocno, int hard_regno) { int cost = 0; + enum machine_mode allocno_mode = ALLOCNO_MODE (allocno); enum reg_class rclass; ira_copy_t cp, next_cp; rclass = REGNO_REG_CLASS (hard_regno); + if (ira_reg_class_max_nregs[rclass][allocno_mode] + > ira_class_hard_regs_num[rclass]) + /* For the above condition the cost can be wrong. Use the allocno + class in this case. */ + rclass = ALLOCNO_CLASS (allocno); for (cp = ALLOCNO_COPIES (allocno); cp != NULL; cp = next_cp) { if (cp->first == allocno) @@ -2754,7 +2760,7 @@ allocno_copy_cost_saving (ira_allocno_t allocno, int hard_regno) } else gcc_unreachable (); - cost += cp->freq * ira_register_move_cost[ALLOCNO_MODE (allocno)][rclass][rclass]; + cost += cp->freq * ira_register_move_cost[allocno_mode][rclass][rclass]; } return cost; } |