public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/113029] New: sel-sched2 ICE in verify_target_availability
@ 2023-12-15  6:44 linkw at gcc dot gnu.org
  2023-12-15  6:50 ` [Bug rtl-optimization/113029] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-12-15  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113029
           Summary: sel-sched2 ICE in verify_target_availability
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linkw at gcc dot gnu.org
  Target Milestone: ---

Test case:

#include <altivec.h>
#define c(d, g) g, d
#define e(d, g) g, d
vector double f, n;
int m;
int k;
void j (vector double, double, double);
vector double combine (double, double);
vector double i (double, double);
vector double l (vector double, double);
vector double
o (vector double, double)
{
  vector double a;
  vector double b;
  p ("");
  j (f, c (1, 2));
  j (n, c (3, 4));
  b = i (3, 4);
  j (a, e (1, 2));
  j (b, e (3, 4));
  j (l (a, 5.0), e (5, 2));
  j (o (b, 6.0), e (3, 6));
  k = vec_extract (b, 1);
  j (combine (0, k), c (2, 4));
  m = vec_extract (b, 0);
  j (i (0, m), e (1, 3));
  i (0, vec_extract (b, 1));
}

Option: -std=c89 -O2 -mcpu=power10 -fselective-scheduling2

during RTL pass: sched2
test.c: In function ‘o’:
test.c:29:1: internal compiler error: in verify_target_availability, at
sel-sched.cc:1553
   29 | }
      | ^
0x10c54c43 verify_target_availability
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:1553
0x10c54c43 find_best_reg_for_expr
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:1667
0x10c54c43 fill_vec_av_set
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:3784
0x10c5555b fill_ready_list
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:4014
0x10c5555b find_best_expr
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:4374
0x10c5555b fill_insns
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:5535
0x10c5555b schedule_on_fences
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7353
0x10c5555b sel_sched_region_2
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7491
0x10c57b8b sel_sched_region_1
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7533
0x10c59723 sel_sched_region(int)
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7634
0x10c59723 sel_sched_region(int)
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7619
0x10c59beb run_selective_scheduling()
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sel-sched.cc:7720
0x10c2e6ef rest_of_handle_sched2
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sched-rgn.cc:3748
0x10c2e6ef execute
        /home/gccbuild/gcc_trunk_git/gcc/gcc/sched-rgn.cc:3895

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/113029] sel-sched2 ICE in verify_target_availability
  2023-12-15  6:44 [Bug rtl-optimization/113029] New: sel-sched2 ICE in verify_target_availability linkw at gcc dot gnu.org
@ 2023-12-15  6:50 ` pinskia at gcc dot gnu.org
  2023-12-15  6:50 ` linkw at gcc dot gnu.org
  2023-12-15  6:56 ` linkw at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-15  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Maybe https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84842#c17 patch helps

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/113029] sel-sched2 ICE in verify_target_availability
  2023-12-15  6:44 [Bug rtl-optimization/113029] New: sel-sched2 ICE in verify_target_availability linkw at gcc dot gnu.org
  2023-12-15  6:50 ` [Bug rtl-optimization/113029] " pinskia at gcc dot gnu.org
@ 2023-12-15  6:50 ` linkw at gcc dot gnu.org
  2023-12-15  6:56 ` linkw at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-12-15  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
I noticed there are some existing PRs (PR107984, PR99328, PR88652, PR84842) on
verify_target_availability ICE, and in PR84842 there is a tentative patch, I
tried to make it fit with the latest trunk, but this still fails, so I file
this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/113029] sel-sched2 ICE in verify_target_availability
  2023-12-15  6:44 [Bug rtl-optimization/113029] New: sel-sched2 ICE in verify_target_availability linkw at gcc dot gnu.org
  2023-12-15  6:50 ` [Bug rtl-optimization/113029] " pinskia at gcc dot gnu.org
  2023-12-15  6:50 ` linkw at gcc dot gnu.org
@ 2023-12-15  6:56 ` linkw at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-12-15  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=88652

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Maybe https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84842#c17 patch helps

Unfortunately it doesn't help, I noticed this and tried below:

diff --git a/gcc/sel-sched.cc b/gcc/sel-sched.cc
index a35b5e16c91..8e3b3bb0467 100644
--- a/gcc/sel-sched.cc
+++ b/gcc/sel-sched.cc
@@ -323,6 +323,10 @@ struct reg_rename

   /* The set of ABIs used by calls that the code motion path crosses.  */
   unsigned int crossed_call_abis : NUM_ABI_IDS;
+
+  /* True if we have merged expressions and one of them had availability
+     bit set.  */
+  unsigned int merged_available_expr : 1;
 };

 /* A global structure that contains the needed information about harg
@@ -388,6 +392,10 @@ struct fur_static_params

   /* The set of ABIs used by calls that the code motion path crosses.  */
   unsigned int crossed_call_abis : NUM_ABI_IDS;
+
+  /* True if we have merged expressions and one of them had availability
+     bit set.  */
+  unsigned int merged_available_expr : 1;
 };

 typedef struct fur_static_params *fur_static_params_p;
@@ -1554,7 +1562,8 @@ verify_target_availability (expr_t expr, regset
used_regs,
                || !hard_available
                || (!reload_completed
                    && reg_rename_p->crossed_call_abis
-                   && REG_N_CALLS_CROSSED (regno) == 0));
+                   && REG_N_CALLS_CROSSED (regno) == 0)
+               || reg_rename_p->merged_available_expr);
 }

 /* Collect unavailable registers due to liveness for EXPR from BNDS
@@ -1654,6 +1663,8 @@ find_best_reg_for_expr (expr_t expr, blist_t bnds, bool
*is_orig_reg_p)
   used_regs = get_clear_regset_from_pool ();
   CLEAR_HARD_REG_SET (reg_rename_data.unavailable_hard_regs);

+  reg_rename_data.crossed_call_abis = false;
+  reg_rename_data.merged_available_expr = false;
   collect_unavailable_regs_from_bnds (expr, bnds, used_regs, &reg_rename_data,
                                      &original_insns);

@@ -1861,7 +1872,7 @@ identical_copy_p (rtx_insn *insn)
 /* Undo all transformations on *AV_PTR that were done when
    moving through INSN.  */
 static void
-undo_transformations (av_set_t *av_ptr, rtx_insn *insn)
+undo_transformations (av_set_t *av_ptr, rtx_insn *insn, void *static_params)
 {
   av_set_iterator av_iter;
   expr_t expr;
@@ -1940,6 +1951,8 @@ undo_transformations (av_set_t *av_ptr, rtx_insn *insn)
                      copy, which was in turn substituted.  The history is
wrong
                      in this case.  Do it the hard way.  */
                   add = substitute_reg_in_expr (tmp_expr, insn, true);
+                if (code_motion_path_driver_info == &fur_hooks)
+                  ((fur_static_params_p) static_params)->merged_available_expr
= true;
                 if (add)
                   av_set_add (&new_set, tmp_expr);
                 clear_expr (tmp_expr);
@@ -3273,6 +3286,7 @@ find_used_regs (insn_t insn, av_set_t orig_ops, regset
used_regs,
   sparams.crossed_call_abis = 0;
   sparams.original_insns = original_insns;
   sparams.used_regs = used_regs;
+  sparams.merged_available_expr = false;

   /* Set the appropriate hooks and data.  */
   code_motion_path_driver_info = &fur_hooks;
@@ -3280,6 +3294,7 @@ find_used_regs (insn_t insn, av_set_t orig_ops, regset
used_regs,
   res = code_motion_path_driver (insn, orig_ops, NULL, &lparams, &sparams);

   reg_rename_p->crossed_call_abis |= sparams.crossed_call_abis;
+  reg_rename_p->merged_available_expr |= sparams.merged_available_expr;

   gcc_assert (res == 1);
   gcc_assert (original_insns && *original_insns);
@@ -6570,7 +6585,7 @@ code_motion_path_driver (insn_t insn, av_set_t orig_ops,
ilist_t path,
            {
              /* Av set ops could have been changed when moving through this
                 insn.  To find them below it, we have to un-substitute them. 
*/
-             undo_transformations (&orig_ops, insn);
+             undo_transformations (&orig_ops, insn, static_params);
            }
          else
            {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-15  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15  6:44 [Bug rtl-optimization/113029] New: sel-sched2 ICE in verify_target_availability linkw at gcc dot gnu.org
2023-12-15  6:50 ` [Bug rtl-optimization/113029] " pinskia at gcc dot gnu.org
2023-12-15  6:50 ` linkw at gcc dot gnu.org
2023-12-15  6:56 ` linkw at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).