Hi,

df_mw_compare tries to order df_mw_hardreg structures lexicographically, but
the last comparison step wrongly tests one field (mw_reg) while subtracting
another (mw_order).  This makes the comparison non-transitive.

Fix this by simply returning difference of mw_order.

Patch pre-approved by Richi in the Bugzilla, bootstrapped on x86_64, applied.

Alexander

        PR rtl-optimization/86096
        * df-scan.c (df_mw_compare): Do not check mw_reg fields when
        comparing mw_order values.

--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2208,10 +2208,7 @@ df_mw_compare (const df_mw_hardreg *mw1, const 
df_mw_hardreg *mw2)
   if (mw1->end_regno != mw2->end_regno)
     return mw1->end_regno - mw2->end_regno;

-  if (mw1->mw_reg != mw2->mw_reg)
-    return mw1->mw_order - mw2->mw_order;
-
-  return 0;
+  return mw1->mw_order - mw2->mw_order;
 }

 /* Like df_mw_compare, but compare two df_mw_hardreg** pointers R1 and R2.  */

Reply via email to