https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84646
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxue at gcc dot gnu.org --- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- So with the last patch I have we eliminate the empty loop that's created by threading but the result is still (or now "again") the imperfect result mentioned in the original description - we fail to exit the outer loop. The main thing the patches in this series did is restore the threading that did the inner loop optimization and the required cleanup. I don't think that this particular thread itself can be enhanced to cover exiting the outer loop. In particular we ask to thread across the loop exit but we know nothing about that apart from the code in the remaining iterations having no side-effect. I'm not sure which kind of pass/transform would be suited to cover this in a more general way than jump threading does. We do have loop splitting which handles this as part of splitting on a "semi-invariant" condition but that fails quite early because it's if (running) { if (other) running = 0; } and we don't seem to handle the conditional "semi-invariant" condition case.