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

--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> ---
And we allocate

plus                         66M      1606M

66 million PLUS RTXen via

explow.c:200 (plus_constant)                             0 :  0.0%     1596M:
92.0%        0 :  0.0%        0 :  0.0%       66M

called by DSE check_mem_read_rtx and record_store.  Ideally we'd not need
any of that via an interface change to canon_true_dependence and friends
(pass in an optional offset).

Most of the time the plus RTX is already present in the original MEM.  Like

Breakpoint 6, record_store (body=0x7ffff42caa98, bb_info=0x3ea3b60)
    at /home/rguenther/src/gcc2/gcc/dse.c:1529
1529        mem_addr = plus_constant (get_address_mode (mem), mem_addr,
offset);
(reg/f:DI 19 frame)
$14 = void
(gdb) p debug_rtx (mem)
(mem/c:DI (plus:DI (reg/f:DI 19 frame)
        (const_int -440 [0xfffffffffffffe48])) [1 MEM[(struct __st_parameter_dt
*)_13].format_len+0 S8 A64])
$15 = void
(gdb) p offset
$16 = {<poly_int_pod<1, long>> = {coeffs = {-440}}, <No data fields>}

trivially pattern matching existing PLUS like

      if (MEM_P (mem)
          && GET_CODE (XEXP (mem, 0)) == PLUS
          && XEXP (XEXP (mem, 0), 0) == mem_addr
          && CONST_INT_P (XEXP (XEXP (mem, 0), 1))
          && known_eq (offset, INTVAL (XEXP (XEXP (mem, 0), 1))))
        mem_addr= XEXP (mem, 0);
      else
        mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);

doesn't help much.  Most cases seem to be build over (value:...) RTXen,
those we could ggc_free I presume.  Doing that in check_mem_read_rtx
doesn't help though.

Reply via email to