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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 39960
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39960&action=edit
gcc7-pr77834-2.patch

Per ml and IRC discussions, this patch attempts not to consider call mem
operand as memory read from the first byte of a function in DSE.
Unfortunately, it breaks pr67960.c testcase at -m32 -Os, we optimize away then
the argument store; while it is store to 8(%ebp), for whatever reason cselib
thinks it is %argp based rather than %ebp and as check is a const sibcall,
doesn't consider the argument memory slot being needed.

I'd say it is a RA bug, in that there is:
(insn 16 3 6 2 (set (reg/v/f:SI 0 ax [orig:89 pi ] [89])
        (mem/f/c:SI (plus:SI (reg/f:SI 6 bp)
                (const_int 8 [0x8])) [2 pi+0 S4 A32])) "pr67690.c":21 82
{*movsi_internal}
     (expr_list:REG_EQUIV (mem/f/c:SI (reg/f:SI 16 argp) [2 pi+0 S4 A32])
        (nil)))
(insn 6 16 7 2 (set (reg:SI 0 ax [orig:90 *pi_3(D) ] [90])
        (mem:SI (reg/v/f:SI 0 ax [orig:89 pi ] [89]) [1 *pi_3(D)+0 S4 A32]))
"pr67690.c":21 82 {*movsi_internal}
     (expr_list:REG_EQUIV (mem:SI (reg/f:SI 16 argp) [0  S4 A32])
        (nil)))
after reload - note in the first insn LRA properly reloaded the argp in (mem
(argp)) in the SET_SRC, but not in REG_EQUIV.  Vlad, do you agree that is a LRA
bug?  But not sure if fixing the REG_EQUIV would help, I've tried to update
them from the debugger and df_insn_rescan at the beginning of dse2, but dse2
still removed the insns.

Reply via email to