https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61515
--- Comment #25 from Jeffrey A. Law <law at redhat dot com> --- So I think there's another approach. invalidate_equivalences is passed in the stack of temporary equivalences, which include those created by jump threading as well as those created by DOM. This means that in theory, we could walk that stack (in reverse order) to find all the equivalences we need to invalidate. If the stack has fewer entries than we have SSA_NAMES, then we win. For the stripped down testcase in this PR we go from ~40 seconds to ~1 second in the relevant part of the compiler with a hack that does exactly what's described above. I need to do a bit more review/research, but it looks like a promising alternative.