From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB3B6385842D; Fri, 15 Dec 2023 06:56:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB3B6385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702623412; bh=4eJvDAWq6YwBgQ8rJTi2lEQ6LIuEidLv8pVjLWTAm4M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vniEmrMlloQ42A0osoGpe/s3xrHEJ1KbYgSo5Cw+m3NEoNquaFHFfSaKInDK4ANHD tmSfA+AONEe3k5/yJ20BZvffPJnuJIu4oibEw4x8uonT6S9MyUN0siIQmTlwMrPsil a4GdqEeFxOad3kvoU7BDON2mcwuSyfltMEECDYYA= From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/113029] sel-sched2 ICE in verify_target_availability Date: Fri, 15 Dec 2023 06:56:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: see_also Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113029 Kewen Lin changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D88652 --- Comment #3 from Kewen Lin --- (In reply to Andrew Pinski from comment #1) > Maybe https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D84842#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) =3D=3D 0)); + && REG_N_CALLS_CROSSED (regno) =3D=3D 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, bo= ol *is_orig_reg_p) used_regs =3D get_clear_regset_from_pool (); CLEAR_HARD_REG_SET (reg_rename_data.unavailable_hard_regs); + reg_rename_data.crossed_call_abis =3D false; + reg_rename_data.merged_available_expr =3D false; collect_unavailable_regs_from_bnds (expr, bnds, used_regs, ®_rename_d= ata, &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_param= s) { av_set_iterator av_iter; expr_t expr; @@ -1940,6 +1951,8 @@ undo_transformations (av_set_t *av_ptr, rtx_insn *ins= n) copy, which was in turn substituted. The history is wrong in this case. Do it the hard way. */ add =3D substitute_reg_in_expr (tmp_expr, insn, true); + if (code_motion_path_driver_info =3D=3D &fur_hooks) + ((fur_static_params_p) static_params)->merged_available_= expr =3D 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 =3D 0; sparams.original_insns =3D original_insns; sparams.used_regs =3D used_regs; + sparams.merged_available_expr =3D false; /* Set the appropriate hooks and data. */ code_motion_path_driver_info =3D &fur_hooks; @@ -3280,6 +3294,7 @@ find_used_regs (insn_t insn, av_set_t orig_ops, regset used_regs, res =3D code_motion_path_driver (insn, orig_ops, NULL, &lparams, &sparam= s); reg_rename_p->crossed_call_abis |=3D sparams.crossed_call_abis; + reg_rename_p->merged_available_expr |=3D sparams.merged_available_expr; gcc_assert (res =3D=3D 1); gcc_assert (original_insns && *original_insns); @@ -6570,7 +6585,7 @@ code_motion_path_driver (insn_t insn, av_set_t orig_o= ps, 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 the= m.=20 */ - undo_transformations (&orig_ops, insn); + undo_transformations (&orig_ops, insn, static_params); } else {=