Commit r14-9459-g618e34d56cc38e only handles
general_scalar_chain::convert_op. The patch also handles
timode_scalar_chain::convert_op to avoid potential similar bug.

Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok for trunk and backport to releases/gcc-13 branch?

gcc/ChangeLog:

        PR target/111822
        * config/i386/i386-features.cc
        (timode_scalar_chain::convert_op): Handle REG_EH_REGION note.
---
 gcc/config/i386/i386-features.cc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index c7d7a965901..38f57d96df5 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -1794,12 +1794,26 @@ timode_scalar_chain::convert_op (rtx *op, rtx_insn 
*insn)
     *op = gen_rtx_SUBREG (V1TImode, *op, 0);
   else if (MEM_P (*op))
     {
+      rtx_insn* eh_insn;
       rtx tmp = gen_reg_rtx (V1TImode);
-      emit_insn_before (gen_rtx_SET (tmp,
-                                    gen_gpr_to_xmm_move_src (V1TImode, *op)),
-                       insn);
+      eh_insn
+       = emit_insn_before (gen_rtx_SET (tmp,
+                                        gen_gpr_to_xmm_move_src (V1TImode,
+                                                                 *op)),
+                           insn);
       *op = tmp;
 
+      if (cfun->can_throw_non_call_exceptions)
+       {
+         /* Handle REG_EH_REGION note.  */
+         rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
+         if (note)
+           {
+             control_flow_insns.safe_push (eh_insn);
+             add_reg_note (eh_insn, REG_EH_REGION, XEXP (note, 0));
+           }
+       }
+
       if (dump_file)
        fprintf (dump_file, "  Preloading operand for insn %d into r%d\n",
                 INSN_UID (insn), REGNO (tmp));
-- 
2.31.1

Reply via email to