[committed] sel-sched: fix sel_rank_for_schedule for qsort (PR 82398)

Message ID alpine.LNX.2.20.13.1712131925320.7275@monopod.intra.ispras.ru
State New
Headers show
Series
  • [committed] sel-sched: fix sel_rank_for_schedule for qsort (PR 82398)
Related show

Commit Message

Alexander Monakov Dec. 13, 2017, 4:37 p.m.
Hello,

I have applied the following patch (ack'ed by Andrey) to fix PR 82398.

The patch pasted in the Bugzilla also had a gcc_checking_assert for
VINSN_UNIQUE_P vs. SCHED_GROUP_P consistency verification earlier in that
comparator, but it's not directly related to the problem at hand, and Andrey
said he'd prefer to handle that differently.

Alexander

        PR rtl-optimization/82398
        * sel-sched.c (sel_rank_for_schedule): Fix check for zero
        EXPR_USEFULNESS in priority comparison.

Patch

--- sel-sched.c (revision 255606)
+++ sel-sched.c (working copy)
@@ -3397,7 +3397,7 @@ 
     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);