------- Comment #17 from bonzini at gnu dot org 2007-12-19 09:49 ------- With this patch, GCC gets the preferences right, but it does not affect code generation.
Index: regclass.c =================================================================== --- regclass.c (revision 130928) +++ regclass.c (working copy) @@ -1651,9 +1651,15 @@ record_reg_classes (int n_alts, int n_op [(unsigned char) reg_pref[REGNO (op)].prefclass] [(int) classes[i]]); - if (REGNO (ops[i]) != REGNO (ops[j]) - && ! find_reg_note (insn, REG_DEAD, op)) - alt_cost += 2; + if (REGNO (ops[i]) != REGNO (ops[j])) + { + /* If the pseudo dies, tying it to the duplicate + operand can be advantageous. */ + if (find_reg_note (insn, REG_DEAD, op)) + pp->cost[classes[j]]--; + else + alt_cost += 2; + } /* This is in place of ordinary cost computation for this operand, so skip to the end of the -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236