https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526
--- Comment #10 from rdapp at linux dot vnet.ibm.com --- Created attachment 38144 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38144&action=edit Tentative patch for VRP and loop-doloop Meanwhile I found the time to implement a pattern for VRP which seems to do the job on tree level. Although larger now (and not many cases are covered yet) I suppose I agree that it fits better in VRP than in ivopts and might even catch more cases than before. The fix on RTL level is nonetheless necessary since doloop calculates the number of iterations independently of the code before and also adds a +1. I cleaned up the fix a little by introducing niterp1_expr (niter plus 1) but there's still room for improvement. No regressions so far, improvement ideas welcome.