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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looking at current 10 branch (previously looked at 11), I see:
(insn 2741 1965 368 2 (set (reg:DI 42 r14 [orig:2067 u128_0 ] [2067])
        (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int 56 [0x38])) [9 %sfp+-1032 S8 A64]))
"pr100342.c":65:24 66 {*movdi_internal}
     (nil))
...
(insn 613 612 1970 2 (set (reg:QI 4 si [orig:125 _98 ] [125])
        (reg:QI 42 r14 [orig:2067 u128_0 ] [2067])) "pr100342.c":68:15 69
{*movqi_internal}
     (nil))
...
(insn 2737 1971 615 2 (set (reg:DI 6 bp [orig:2067 u128_0 ] [2067])
        (reg:DI 42 r14 [orig:2067 u128_0 ] [2067])) "pr100342.c":68:12 66
{*movdi_internal}
     (nil))
...
(insn 2275 658 659 2 (set (reg:DI 1 dx [2225])
        (reg:DI 4 si [orig:125 _98 ] [125])) "pr100342.c":68:12 66
{*movdi_internal}
     (nil))
...
(insn 2287 2286 710 2 (set (reg:DI 1 dx [orig:131 _104 ] [131])
        (reg:DI 6 bp [orig:2067 u128_0 ] [2067])) "pr100342.c":72:5 66
{*movdi_internal}
     (nil))
(insn 710 2287 2172 2 (set (reg:DI 1 dx [orig:131 _104 ] [131])
        (bswap:DI (reg:DI 1 dx [orig:131 _104 ] [131]))) "pr100342.c":72:5 872
{*bswapdi2}
     (nil))
in the reload dump and I must say I don't find anything wrong on that,
what looks wrong is that regcprop thinks that the insn 2287 is a redundant move
because it thinks that at that point %rdx contains the same value as %rbp -
      /* Detect noop sets and remove them before processing side effects.  */
      if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set)))
        {
          unsigned int regno = REGNO (SET_SRC (set));
          rtx r1 = find_oldest_value_reg (REGNO_REG_CLASS (regno),
                                          SET_DEST (set), vd);
          rtx r2 = find_oldest_value_reg (REGNO_REG_CLASS (regno),
                                          SET_SRC (set), vd);
          if (rtx_equal_p (r1 ? r1 : SET_DEST (set), r2 ? r2 : SET_SRC (set)))
            {
              bool last = insn == BB_END (bb);
              delete_insn (insn);
r1 is %rbp and r2 is NULL, so it is compared against SET_SRC (set) of %rbp.
Something misses that only the lowpart QImode is equivalent that way.

Reply via email to