http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57904
--- Comment #10 from Jeffrey A. Law <law at redhat dot com> --- Bernd, It's certainly good if the test outside the loop and inside the loop is the same. It's a lot more likely to be discovered to be redundant earlier. I have no idea how it would affect ivopts. Regardless of what the front-end presents us with, the early optimizers are just doing a crappy job here. If you look at the IL dump and propagate/simplify based on ubound_3 = 0 you'll find that a ton of code just goes away. The question in my mind is can we get the propagation/simplifications we want with a reasonable cost. We certainly have passes that will clean this up that we could schedule to run after copyprop, but an integrated solution may be significantly better from a compile-time standpoint. It also helps that we already have code which does, probably 95% of what we need in phi-only cprop. I suspect if we just marked things that obviously simplified down to copies/constants and re-used the phi-only-cprop code that everything would "just work" with a minimal compile-time hit. I'm hoping to prototype that tomorrow.