From: Vladimir Makarov Date: Tue, 20 Dec 2011 21:29:36 +0000 (+0000) Subject: re PR target/49865 (Unnecessary reload causes small bloat) X-Git-Tag: releases/gcc-4.7.0~1398 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d19c7329c6da0b59df04b32bca26f7d2c1ce20a;p=thirdparty%2Fgcc.git re PR target/49865 (Unnecessary reload causes small bloat) 2011-12-20 Vladimir Makarov PR target/49865 * ira-costs.c (find_costs_and_classes): Prefer registers even if the memory cost is the same. From-SVN: r182553 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad53a035ba96..9bbfbcbaf305 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-12-20 Vladimir Makarov + + PR target/49865 + * ira-costs.c (find_costs_and_classes): Prefer registers even + if the memory cost is the same. + 2011-12-20 Joseph Myers * c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield) diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 4fa12a2ae19f..4f2f8412f7c9 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1693,7 +1693,14 @@ find_costs_and_classes (FILE *dump_file) else if (i_costs[k] == best_cost) best = ira_reg_class_subunion[best][rclass]; if (pass == flag_expensive_optimizations - && i_costs[k] < i_mem_cost + /* We still prefer registers to memory even at this + stage if their costs are the same. We will make + a final decision during assigning hard registers + when we have all info including more accurate + costs which might be affected by assigning hard + registers to other pseudos because the pseudos + involved in moves can be coalesced. */ + && i_costs[k] <= i_mem_cost && (reg_class_size[reg_class_subunion[alt_class][rclass]] > reg_class_size[alt_class])) alt_class = reg_class_subunion[alt_class][rclass];