https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91333
--- Comment #6 from Vladimir Makarov <vmakarov at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #5) > > However, if I add -mavx, I get > > vmovapd %xmm0, %xmm2 > vmovapd %xmm1, %xmm4 > vmovapd %xmm1, %xmm0 > vaddsd %xmm0, %xmm4, %xmm0 > vmovapd %xmm2, %xmm3 > vaddsd %xmm2, %xmm3, %xmm2 > vaddsd %xmm0, %xmm2, %xmm0 > > That's 2 extra moves compared to the non-avx version, which seems wrong > since AVX gives more freedom to the RA. > Those initial moves look quite similar to the ones I get for f with gcc-9 > -O3 -mno-avx, so the optimization looks fragile. Thank you for reporting this. I've started to work on this and found that RTL before RA became a bit different and this changed order of pushing colorable allocnos on coloring stack and this changed the final assignment. I hope to find a solution and fix this problem on the next week. As it is about heuristics, any fix will need a good benchmarking to confirm the change and it will take some time.