On 2022-03-23 07:49, Richard Biener wrote:
form_threads_from_copies processes a sorted array of copies, skipping those with the same thread and conflicting threads and merging the first non-conflicting ones. After that it terminates the loop and gathers the remaining elements of the array, skipping same thread copies, re-starting the process. For a large number of copies this gathering of the rest takes considerable time and it also appears pointless. The following simply continues processing the array which should be equivalent as far as I can see.
It looks the same to me that the result code is equivalent to the original one.
As I remember originally it was more sophisticated but even more slower algorithm taking into account that merging 2 threads could remove several copies (not just one) from the array and choosing the best copy with this point of view. It was transformed into this ineffective leftover code.
This takes form_threads_from_copies off the profile radar from previously taking ~50% of the compile-time. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. OK if testing succeeds?
Yes. Thank you for working on this, Richard.