https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78496
--- Comment #3 from Jeffrey A. Law <law at redhat dot com> --- So I've been pondering this a bit more. Essentially I see two paths forward. One is to enhance the backwards threader so that it can do more general lookups/simplifications. I've cobbled together some code for this, but it's certainly not gcc-7 material and even once working it may not necessarily capture this case. The second would be to take advantage of some of the DOM restructuring we did a year or so ago and do a block local jump threading pass where the edges/blocks to consider are seeded by phi-only-cprop. Depending on the cost iterating phi-only-cprop and a local threader might be acceptable -- particularly if we throttled back threading elsewhere. I haven't cobbled together any code for the second approach, but it shouldn't be hard to prototype a non-iterating implementation. Most of the infrastructure we need is already in place.