[Bug target/68421] unused copy of global register variable into another gpr

acsawdey at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 19 17:30:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68421

--- Comment #2 from acsawdey at gcc dot gnu.org ---
So, looking at the dump files, at the end of tree form we have copies from the
register globals and uses of the copies only:

  <bb 2>:
  execute_data.0_4 = execute_data;
  opline.1_5 = opline;
  _6 = opline.1_5->op1.var;

Then after reload, those temps get allocated to 8 and 10 and only 8/10 are used
after the initial copy:

(insn 8 2 7 2 (set (reg/f:DI 8 8 [orig:157 opline.1_5 ] [157])
        (reg/v:DI 29 29 [ opline ])) min_unused_regs10.c:51 538
{*movdi_internal64}
     (nil))
(insn 7 8 9 2 (set (reg/f:DI 10 10 [orig:156 execute_data.0_4 ] [156])
        (reg/v:DI 28 28 [ execute_data ])) min_unused_regs10.c:51 538
{*movdi_internal64}
     (nil))
(insn 9 7 10 2 (set (reg:DI 6 6 [orig:172 opline.1_5->op1.var ] [172])
        (sign_extend:DI (mem:SI (reg/f:DI 8 8 [orig:157 opline.1_5 ] [157]) [0
opline.1_5->op1.var+0 S4 A32]))) min_unused_regs10.c:41 46 {extendsidi2}
     (nil))
(insn 10 9 11 2 (set (reg/f:DI 9 9 [orig:169 _29 ] [169])
        (plus:DI (reg/f:DI 10 10 [orig:156 execute_data.0_4 ] [156])
            (reg:DI 6 6 [orig:172 opline.1_5->op1.var ] [172])))
min_unused_regs10.c:41 81 {*adddi3}
     (nil))

Then after cprop_hardreg, the uses of 8/10 are replaced with 29/28 except for
that initial copy which is what remains:

(insn 8 2 7 2 (set (reg/f:DI 8 8 [orig:157 opline.1_5 ] [157])
        (reg/v:DI 29 29 [ opline ])) min_unused_regs10.c:51 538
{*movdi_internal64}
     (nil))
(insn 7 8 9 2 (set (reg/f:DI 10 10 [orig:156 execute_data.0_4 ] [156])
        (reg/v:DI 28 28 [ execute_data ])) min_unused_regs10.c:51 538
{*movdi_internal64}
     (nil))
(insn 9 7 10 2 (set (reg:DI 6 6 [orig:172 opline.1_5->op1.var ] [172])
        (sign_extend:DI (mem:SI (reg/f:DI 29 29 [orig:157 opline.1_5 ] [157])
[0 opline.1_5->op1.var+0 S4 A32]))) min_unused_regs10.c:41 46 {extendsidi2}
     (nil))
(insn 10 9 11 2 (set (reg/f:DI 9 9 [orig:169 _29 ] [169])
        (plus:DI (reg/f:DI 28 28 [orig:156 execute_data.0_4 ] [156])
            (reg:DI 6 6 [orig:172 opline.1_5->op1.var ] [172])))
min_unused_regs10.c:41 81 {*adddi3}
     (nil))


More information about the Gcc-bugs mailing list