On Thu, Jun 26, 2025 at 1:24 PM Hongtao Liu <crazy...@gmail.com> wrote:
>
> On Thu, Jun 26, 2025 at 6:20 AM H.J. Lu <hjl.to...@gmail.com> wrote:
> >
> > For tcpsock_test.go in libgo tests,
> >
> > commit aba3b9d3a48a0703fd565f7c5f0caf604f59970b
> > Author: H.J. Lu <hjl.to...@gmail.com>
> > Date:   Fri May 9 07:17:07 2025 +0800
> >
> >     x86: Extend the remove_redundant_vector pass
> >
> > added an instruction:
> >
> > (insn 501 101 102 21 (set (reg:V2DI 234)
> >         (vec_duplicate:V2DI (reg:DI 111 [ _46 ]))) "tcpsock_test.go":691:12 
> > disc
> > rim 1 -1
> >      (nil))
> >
> > after
> >
> > (insn 101 100 501 21 (set (reg:DI 111 [ _46 ])
> >         (mem:DI (reg/f:DI 110 [ _45 ]) [5 *_45+0 S8 A64])) 
> > "tcpsock_test.go":691
> > :12 discrim 1 99 {*movdi_internal}
> >      (expr_list:REG_DEAD (reg/f:DI 110 [ _45 ])
> >         (expr_list:REG_EH_REGION (const_int 1 [0x1])
> >             (nil))))
> >
> > which resulted in
> >
> > (insn 101 100 501 21 (set (reg:DI 111 [ _46 ])
> >         (mem:DI (reg/f:DI 110 [ _45 ]) [5 *_45+0 S8 A64])) 
> > "tcpsock_test.go":691
> > :12 discrim 1 99 {*movdi_internal}
> >      (expr_list:REG_DEAD (reg/f:DI 110 [ _45 ])
> >         (expr_list:REG_EH_REGION (const_int 1 [0x1])
> >             (nil))))
> > (insn 501 101 102 21 (set (reg:V2DI 234)
> >         (vec_duplicate:V2DI (reg:DI 111 [ _46 ]))) "tcpsock_test.go":691:12 
> > disc
> > rim 1 -1
> >      (nil))
> >
> > and caused:
> >
> > tcpsock_test.go: In function 'net.TestTCPBig..func2':
> > tcpsock_test.go:684:28: error: in basic block 21:
> >   684 |                         go func() {
> >       |                            ^
> > tcpsock_test.go:684:28: error: flow control insn inside a basic block
> > (insn 101 100 501 21 (set (reg:DI 111 [ _46 ])
> >         (mem:DI (reg/f:DI 110 [ _45 ]) [5 *_45+0 S8 A64])) 
> > "tcpsock_test.go":691
> > :12 discrim 1 99 {*movdi_internal}
> >      (expr_list:REG_DEAD (reg/f:DI 110 [ _45 ])
> >         (expr_list:REG_EH_REGION (const_int 1 [0x1])
> >             (nil))))
> > during RTL pass: rrvl
> > tcpsock_test.go:684:28: internal compiler error: in rtl_verify_bb_insns, at 
> > cfgr
> > tl.cc:2834
> >
> > Copy the REG_EH_REGION note to the newly added instruction and split the
> > block after the previous instruction.
> >
> > PR target/120816
> > * config/i386/i386-features.cc (remove_redundant_vector_load):
> > Handle REG_EH_REGION note in DEF_INSN.
> >
> > OK for master
> +     if (note)
> +       {
> +          control_flow_insns.safe_push (load->def_insn);
> +          add_reg_note (insn, REG_EH_REGION,
> +                                 XEXP (note, 0));
> +       }
> I think we don't need to add_reg_not to vec_duplicate insn.

I tried this:

diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index 054f8d5ddc8..30e314b999f 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -3857,8 +3857,6 @@ remove_redundant_vector_load (void)
          if (note)
            {
         control_flow_insns.safe_push (load->def_insn);
-        add_reg_note (insn, REG_EH_REGION,
-                 XEXP (note, 0));
            }
        }

and got

tcpsock_test.go: In function ‘net.TestTCPBig..func2’:
tcpsock_test.go:684:28: error: missing REG_EH_REGION note at the end of bb 71
  684 |                         go func() {
      |                            ^
during RTL pass: rrvl
tcpsock_test.go:684:28: internal compiler error: verify_flow_info failed
0x2c6522b internal_error(char const*, ...)
/export/gnu/import/git/gitlab/x86-gcc-test/gcc/diagnostic-global-context.cc:517
0x65ddf5 verify_flow_info()
/export/gnu/import/git/gitlab/x86-gcc-test/gcc/cfghooks.cc:287
0xc9612e execute_function_todo
/export/gnu/import/git/gitlab/x86-gcc-test/gcc/passes.cc:2115
0xc94d66 do_per_function
/export/gnu/import/git/gitlab/x86-gcc-test/gcc/passes.cc:1703
0xc962a1 execute_todo
/export/gnu/import/git/gitlab/x86-gcc-test/gcc/passes.cc:2155
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

> Other LGTM.
> I'm wondering if emit_insn_after can be extended to handle this

It is a possibility.

> situation. It looks like a general issue to me, at least we met it
> several times.
>
> >
> > --
> > H.J.
>
>
>
> --
> BR,
> Hongtao



-- 
H.J.

Reply via email to