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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
2025-11-10  Jakub Jelinek  <[email protected]>

        PR lto/122620
        * gimplify-me.cc (gimple_regimplify_operands): Don't try to regimplify
        TREE_CLOBBER on rhs of gimple_clobber_p if it has gimple_reg_type.

--- gcc/gimplify-me.cc.jj       2025-10-22 13:30:36.000000000 +0200
+++ gcc/gimplify-me.cc  2025-11-10 15:32:24.747470202 +0100
@@ -232,9 +232,13 @@ gimple_regimplify_operands (gimple *stmt
          else if (i == 2
                   && gimple_assign_single_p (stmt)
                   && num_ops == 2)
-           gimplify_expr (&op, &pre, NULL,
-                          rhs_predicate_for (gimple_assign_lhs (stmt)),
-                          fb_rvalue);
+           {
+             if (gimple_clobber_p (stmt))
+               continue;
+             gimplify_expr (&op, &pre, NULL,
+                            rhs_predicate_for (gimple_assign_lhs (stmt)),
+                            fb_rvalue);
+           }
          else if (i == 2 && is_gimple_call (stmt))
            {
              if (TREE_CODE (op) == FUNCTION_DECL)
@@ -253,8 +257,9 @@ gimple_regimplify_operands (gimple *stmt
        {
          bool need_temp = false;

-         if (gimple_assign_single_p (stmt)
-             && num_ops == 2)
+         if (gimple_clobber_p (stmt))
+           ;
+         else if (gimple_assign_single_p (stmt) && num_ops == 2)
            gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL,
                           rhs_predicate_for (gimple_assign_lhs (stmt)),
                           fb_rvalue);

seems to fix the ICE for me, but I haven't been successful in trying to
minimize a testcase for this.  I can manage to have a MEM_REF = CLOBBER with
int or other gimple reg type very easily, but haven't managed so far to force
either OpenMP or inliner (the only spots which regimplify stuff) to trigger
regimplification of it.

Reply via email to