------- Comment #5 from carrot at google dot com 2010-03-18 03:52 ------- In this case arm_arm_address_cost does the right thing. The problem is in function should_replace_address.
When two addresses have same address cost, we choose the one with higher rtx cost. The reason is "That has the potential of eliminating the most insns without additional costs". But when two addresses have the same rtx cost, they also have the potential to eliminate a previous definition. Just as demonstrated by this test case. One of the candidate is old_rtx (plus:SI (reg/v/f:SI 133 [ saveArea ]) (const_int 8 [0x8])) new_rtx (plus:SI (reg/v/f:SI 140 [ fp ]) (const_int -8 [0xfffffffffffffff8])) After all of these addresses being replaced, instruction A can be removed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43286