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

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
            case Action::CHANGE:
            {
              set_pair_pat (change);
              change->new_uses = merge_access_arrays (attempt,
                                                      input_uses[0],
                                                      input_uses[1]);

returns invalid.

Because:

(gdb) p *(use_info *)access2
$13 = {<rtl_ssa::access_info> = {m_regno = 0, m_mode = E_DImode, m_kind =
rtl_ssa::access_kind::USE, m_is_artificial = 0,
m_is_set_with_nondebug_insn_uses = 0, m_is_pre_post_modify = 0,
m_is_call_clobber = 0, m_is_live_out_use = 0, m_includes_address_uses = 0,
m_includes_read_writes = 0, m_includes_subregs = 0,
    m_includes_multiregs = 0, m_only_occurs_in_notes = 0,
m_is_last_nondebug_insn_use = 1, m_is_in_debug_insn_or_phi = 0,
m_has_been_superceded = 0, m_is_temp = 0}, m_insn_or_phi = {m_ptr = 0x4b64db8
"8M\266\004"}, m_last_use_or_prev_use = {m_ptr = 0x4b64e28 ""},
m_last_nondebug_insn_use_or_next_use = {
    m_ptr = 0x4b64e28 ""}, m_def = 0x4b64d80}
(gdb) p *(use_info *)access1
$14 = {<rtl_ssa::access_info> = {m_regno = 0, m_mode = E_DImode, m_kind =
rtl_ssa::access_kind::USE, m_is_artificial = 0,
m_is_set_with_nondebug_insn_uses = 0, m_is_pre_post_modify = 0,
m_is_call_clobber = 0, m_is_live_out_use = 0, m_includes_address_uses = 0,
m_includes_read_writes = 0, m_includes_subregs = 0,
    m_includes_multiregs = 0, m_only_occurs_in_notes = 0,
m_is_last_nondebug_insn_use = 0, m_is_in_debug_insn_or_phi = 0,
m_has_been_superceded = 0, m_is_temp = 0}, m_insn_or_phi = {m_ptr = 0x4b64c58
"\310K\266\004"}, m_last_use_or_prev_use = {m_ptr = 0x0},
m_last_nondebug_insn_use_or_next_use = {m_ptr = 0x0},
  m_def = 0x0}


can_merge_accesses returns false for those 2.

These 2 access corresponds to the 2 defining rtl statements from their uses
inside the stores:
(insn 5 2 15 2 (clobber (reg:DI 0 x0 [orig:103 aD.4508 ] [103]))
"/app/example.cpp":3:23 -1
     (nil))
...
(insn 18 15 16 2 (set (reg:DI 0 x0 [orig:104 aD.4508+8 ] [104])
        (const_int 1 [0x1])) "/app/example.cpp":17:5 70 {*movdi_aarch64}
     (expr_list:REG_EQUIV (const_int 1 [0x1])
        (nil)))

Though in this case m_def for access1 is null because it was a clobber.

Even though I think we can actually merge the uses here because the access1 use
of x0 can be anything as it was "defined" by the clobber.
I am not sure where the right place to do that.

is merge_access_arrays the correct place or somewhere else?

Reply via email to