https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82398
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abel at gcc dot gnu.org, | |amonakov at gcc dot gnu.org --- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> --- This might be a typo in treatment of EXPR_USEFULNESS in comparator, adding Andrey. Tentative patch: diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index 87a483a231e..88d8c50b508 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -3369,6 +3369,8 @@ sel_rank_for_schedule (const void *x, const void *y) if (VINSN_UNIQUE_P (tmp_vinsn) && VINSN_UNIQUE_P (tmp2_vinsn)) return SCHED_GROUP_P (tmp2_insn) ? 1 : -1; + gcc_checking_assert (VINSN_UNIQUE_P (tmp_vinsn) + || VINSN_UNIQUE_P (tmp2_vinsn)); /* Now uniqueness means SCHED_GROUP_P is set, because schedule groups cannot be cloned. */ if (VINSN_UNIQUE_P (tmp2_vinsn)) @@ -3397,7 +3399,7 @@ sel_rank_for_schedule (const void *x, const void *y) return 1; /* Prefer an expr with greater priority. */ - if (EXPR_USEFULNESS (tmp) != 0 && EXPR_USEFULNESS (tmp2) != 0) + if (EXPR_USEFULNESS (tmp) != 0 || EXPR_USEFULNESS (tmp2) != 0) { int p2 = EXPR_PRIORITY (tmp2) + EXPR_PRIORITY_ADJ (tmp2), p1 = EXPR_PRIORITY (tmp) + EXPR_PRIORITY_ADJ (tmp);