[Bug rtl-optimization/44249] [4.4/4.5/4.6 Regression] IRA generates extra register move

vmakarov at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 24 18:21:00 GMT 2010


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

--- Comment #2 from Vladimir Makarov <vmakarov at redhat dot com> 2010-11-24 17:40:56 UTC ---
Reload creates additional insn for insn

(insn 9 7 11 2 (parallel [
            (set (reg:DI 71)
                (lshiftrt:DI (reg/v:DI 60 [ tag ])
                    (const_int 4 [0x4])))
            (clobber (reg:CC 17 flags))
        ]) b.i:5 533 {*lshrdi3_1}
     (expr_list:REG_DEAD (reg/v:DI 60 [ tag ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

That is because r60 and r71 got different registers (0 an 1) even
although there is a copy between r71 and r60 which should result in
getting r70 hard register 0 as r60 one.  It does not happen because
r68 already got 0 and it conflicts with r71:

    r71: preferred GENERAL_REGS, alternative NO_REGS, cover GENERAL_REGS
    r68: preferred AREG, alternative GENERAL_REGS, cover GENERAL_REGS
    r60: preferred GENERAL_REGS, alternative NO_REGS, cover GENERAL_REGS

;; a0(r68,l0) conflicts: a1(r71,l0)

;; a4(r67,l0) conflicts:  cp0:a1(r71)<->a3(r60)@1000:constraint

      Popping a0(r68,l0)  -- assign reg 0
      Popping a3(r60,l0)  -- assign reg 0
      Popping a1(r71,l0)  -- assign reg 1

Analogous insn for gcc-4.3 looks like

(insn:HI 9 7 11 2 b.i:4 (parallel [
            (set (reg/v:DI 58 [ tag ])
                (lshiftrt:DI (reg/v:DI 58 [ tag ])
                    (const_int 4 [0x4])))
            (clobber (reg:CC 17 flags))
        ]) 514 {*lshrdi3_1_rex64} (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

It means there is no such problem as in gcc4.4+.

Insn 9 for gcc-4.3 is a result of regmove transformation.  I have no
idea why regmove (which is present in gcc4.4+) does not do the same
for gcc4.4+ (probably because of some changes since 4.3).

The problem could be fixed in regmove or in IRA (which is probably
harder).  But I don't know is it worth to do it.  Because such
transformations result in longer live ranges of pseudos and might
result in worse code for other programs.



More information about the Gcc-bugs mailing list