https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64164
Alexandre Oliva <aoliva at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aoliva at gcc dot gnu.org --- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- The problem starts in the first copyrename pass. We refrain from coalescing variables if neither has a usable root. This causes us to fail to coalesce partitions that we would coalesce if only we tried them in a different order (i.e., P1 and P2 fail but either one coalesces with P3, and then the other would coalesce with that union). This is exactly what happens in AO_myload with -DOPT: partitions _3 and _6 won't coalesce, and then result_4 and _6 coalesce, which would enable _3 to coalesce too. This in turn brings additional rootless variables into stm_load, which again fail to coalesce because we try them first (_36 and _4 fails, and l_11 and _36 passes, so that with _4 would work). Without -DOPT, we succeed in coalescing result (there are fewer SSA names), and when that is inlined, it gets there with a root symbol, so that coalescing of _36 and result_4 succeeds. In both cases, we coalesce l_11 with result_36, and it is precisely because _4 remains separate that we end up introducing copies in new blocks when going out of SSA into RTL. Coalescing SSA names even when neither has a root removes the optimization differences for this testcase.