https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81834
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2017-08-16 CC| |rguenth at gcc dot gnu.org Summary|Simple loop with single |loop with increment |variable is not optimized |conditional on IV is not |out |optimized out Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- There's a chicken-and-egg issue in optimization -- proving that i < 1000 is always true for the increment requires the number of iterations to be known and that requires this condition to be simplified. optimistic VRP should be able to figure this out together with SCEV but SCEV isn't fed with the intermediate VRP info nor does VRP query SCEV during iteration at the right point. Quite an arcane case though... clang doesn't get it either.