------- Comment #8 from amacleod at redhat dot com 2007-03-05 22:52 ------- Created an attachment (id=13150) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13150&action=view) proposed patch for 4.2
This is the same patch for the 4.2 compiler. Unfortunately, its not quite good enough because the rtl optimizers still manage to do the wrong thing. In mainline, life recognizes that the register is dead in the copy: (insn 7 5 8 2 (parallel [ (set (reg:SI 58 [ reg.27 ]) (plus:SI (reg/v:SI 5 di [ reg ]) (const_int -4 [0xfffffffc]))) (clobber (reg:CC 17 flags)) ]) 148 {*addsi_1} (nil) (expr_list:REG_DEAD (reg/v:SI 5 di [ reg ]) (expr_list:REG_UNUSED (reg:CC 17 flags) (nil)))) (insn 8 7 9 2 (set (reg/v:SI 5 di [ reg ]) (reg:SI 58 [ reg.27 ])) 34 {*movsi_1} (insn_list:REG_DEP_TRUE 7 (nil)) (expr_list:REG_DEAD (reg:SI 58 [ reg.27 ]) (nil))) and combine turns it into: (insn 8 7 9 2 (parallel [ (set (reg/v:SI 5 di [ reg ]) (plus:SI (reg/v:SI 5 di [ reg ]) (const_int -4 [0xfffffffc]))) (clobber (reg:CC 17 flags)) ]) 148 {*addsi_1} (nil) on the 4.2 branch, we don't seem to get it right and combine, nor anyone else I suppose, manages to get merge the 2 insns. so we end up aith the same assembly. Unless someone sees something in the RTL optimizers that can be tweaked that can figure this out, there isn't much point in applying this to 4.2. Im not planning to look into the RTL side myself, but I will see if there is anything else TER can do to get rid of this situation in 4.2. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21596