https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118611
--- Comment #7 from Vladimir Makarov <vmakarov at gcc dot gnu.org> --- I worked on this issue this week. I tried several approaches. I added the best patch as an attachment. The patch changes an order of coloring allocnos in one thread. Unfortunately, although the patch solves the problem but it adds 2 x86-64 failures of tests expecting smaller number of moves. It also adds 2 failures for aarch64 tests but I found the code quality is the same (probably something wrong with regexps used to check the assembler code). For ppc64le there are no additional test failures. x86-64 SPEC2017 results are the same with and without the patch (with very small the code size changes). So I don't think it is worth to submit the patch and I think this issue will be not solved sometimes soon. It is just a case when heuristics do not work well.