------- Comment #4 from carrot at google dot com 2010-07-09 22:11 ------- Consider following case:
add r3, r1, r2 ldr r4, [r3] Suppose there is no other usage of r3, propagate the first instruction into the second and remove the first is the correct behavior and beneficial. This is also the current cost model's behavior. So I was really confused by the function name arm_arm_address_cost. Suppose there is another usage of r3 in later instructions, even we propagate the first instruction into the second instruction, we can't delete the first one. So there is no beneficial with the propagation and we should stop. My original test case is very similar. The (reg 137) is used more than once, the propagation can't make insn 15 dead, so the result is not better. On the contrary it prevents other optimization (combine of insn 13 and insn 15). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44883