On 12/17/2015 04:00 AM, Yury Gribov wrote:
This patch fixes intransitive comparison in reload_pseudo_compare_func. Imagine the following
situation:
1) bitmap_bit_p is unset for A and B but set for C
2) A < B (due to early ira_reg_class_max_nregs comparison)
3) B < C (due to following regno_assign_info comparison)

It may then easily happen that A > C (due to regno_assign_info comparison) which violates the transitiveness requirement of total ordering.

Unfortunately I'm not sure how to properly fix this so Cc-ing Vladimir for help.

Yury, thanks for reporting this. Yes that could be a problem but I can not approve this patch as it might result in *significant* performance degradation. I remember the code. What you propose is the original patch (PR57878) and it was exactly modified to the current version because of the negative performance impact. The current code is safe although it might result into infinite cycling for some sort algorithms but not for used qsort.

I'll think how to fix it better. Probably I will need two comparison functions for different assignment iterations. The solution will need benchmarking as the code is critical for LRA performance. Could you fill a bug report in order not to forget the issue.


Reply via email to