[PATCH] Fix PR82396: qsort comparator non-negative on sorted output

Wilco Dijkstra Wilco.Dijkstra@arm.com
Fri Oct 6 13:24:00 GMT 2017


Maxim Kuvyrkov wrote:

Note I've committed: https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00309.html which does
change qsort to (qsort) like Jakub proposed.

> I think that this is the best solution so far.  Could you add a comment like the following?
> ==
> Ideally, we would call autopref_rank_data() here, but we can't since it is not guaranteed
> to return transitive results fro multi_mem_insns.  We use an approximation here and rely
> on lookahead_guard below to force instruction order according to autopref_rank_data().
> ==

The issue is that autopref_rank_data() doesn't do anything useful. It checks for overlaps
which shouldn't happen much, if at all. And as discussed declaring a comparison as
"unordered" is simply not possible. lookahead_guard can't fix things up either, so there is
really no point in keeping this function. Similarly all the min/max offset calculations are
redundant even if we assume the offsets in a LDP/STP instruction are completely random.

Wilco





    


More information about the Gcc-patches mailing list