https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134
--- Comment #21 from JuzheZhong <juzhe.zhong at rivai dot ai> --- Hi, Richard. I looked into ivcanon. I found that: /* If the loop has more than one exit, try checking all of them for # of iterations determinable through scev. */ if (!exit) niter = find_loop_niter (loop, &exit); In find_loop_niter, we iterate 2 exit edges: 1. bb 5 -> bb 6 with niter = (unsigned int) N_13(D). 2. bb 3 -> bb 6 with niter = 1001. It just skip niter = (unsigned int) N_13(D) in: if (!integer_zerop (desc.may_be_zero)) continue; find_loop_niter (loop, &exit) return 1001 with skipping (unsigned int) N_13(D). Should it return MIN (1001, (unsigned int) N_13(D)). I prefer fix it in ivcanon since I believe it would be more elegant than fix it in loop splitter. I am still investigating, any guides will be really appreciated. Thanks.