http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43491

--- Comment #3 from amker.cheng <amker.cheng at gmail dot com> 2011-11-24 
09:24:37 UTC ---
(In reply to comment #1)

> 
> I'm thinking that this is perfectly normal thing to do, and that the redundant
> move is meant to disappear in a later pass.  My guess is that IRA is choosing
> not to assign the pseudo to r4, but I do not know why at the moment.

As dump in 191r.shed1:
------------------------------------------
(insn 5 7 6 2 (set (reg/f:SI 135 [ reg.0 ])
        (reg/v:SI 4 r4 [ reg ])) pr43491.c:16 709 {*thumb2_movsi_insn}
     (expr_list:REG_DEAD (reg/v:SI 4 r4 [ reg ])
        (nil)))

(insn 6 5 8 2 (set (reg:SI 137 [ MEM[(unsigned int *)reg.0_12 + 8B] ])
        (mem:SI (plus:SI (reg/f:SI 135 [ reg.0 ])
                (const_int 8 [0x8])) [2 MEM[(unsigned int *)reg.0_12 + 8B]+0 S4
A32])) pr43491.c:16 709 {*thumb2_movsi_insn}
     (nil))

(jump_insn 8 6 49 2 (parallel [
            (set (pc)
                (if_then_else (eq (reg:SI 137 [ MEM[(unsigned int *)reg.0_12 +
8B] ])
                        (const_int 0 [0]))
                    (label_ref:SI 22)
                    (pc)))
            (clobber (reg:CC 24 cc))
        ]) pr43491.c:16 747 {*thumb2_cbz}
     (expr_list:REG_DEAD (reg:SI 137 [ MEM[(unsigned int *)reg.0_12 + 8B] ])
        (expr_list:REG_UNUSED (reg:CC 24 cc)
            (expr_list:REG_BR_PROB (const_int 900 [0x384])
                (nil))))
 -> 22)

(code_label 49 8 48 3 4 "" [1 uses])

(note 48 49 16 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(note 16 48 14 3 NOTE_INSN_DELETED)

(call_insn 14 16 15 3 (parallel [
            (call (mem:SI (symbol_ref:SI ("c") [flags 0x41]  <function_decl
0xb76c3b80 c>) [0 c S4 A32])
                (const_int 0 [0]))
            (use (const_int 0 [0]))
            (clobber (reg:SI 14 lr))
        ]) pr43491.c:17 247 {*call_symbol}
     (nil)
    (nil))

(insn 15 14 17 3 (set (reg:SI 138 [ MEM[(unsigned int *)reg.0_12 + 8B] ])
        (mem:SI (plus:SI (reg/f:SI 135 [ reg.0 ])
                (const_int 8 [0x8])) [2 MEM[(unsigned int *)reg.0_12 + 8B]+0 S4
A32])) pr43491.c:16 709 {*thumb2_movsi_insn}
     (nil))
------------------------------------------
Since reg is manually declared in r4, function globalize_reg sets r4 in
fixed_reg_set/call_used_reg_set/call_fixed_reg_set. IRA then add r4 into
allocno(r135)'s conflict_hard_regs. That's why IRA not assigns the pseudo(r135)
to r4. I guess it's natural unless we can make IRA aware of constant register.

Reply via email to