https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97627
--- Comment #11 from bin cheng <amker at gcc dot gnu.org> ---
(In reply to bin cheng from comment #10)
> hmm,
> For below basic block:
> 128 ;; basic block 4, loop depth 2, maybe hot
> 129 ;; prev block 3, next block 9, flags: (NEW, VISITED)
> 130 ;; pred: 3 (FALLTHRU,EXECUTABLE)
> 131 ;; 7 (FALLTHRU,DFS_BACK,EXECUTABLE)
> 132 # RANGE [0, 2147483647] NONZERO 2147483647
> 133 # c_5 = PHI <0(3), c_17(7)>
> 134 # .MEM_8 = PHI <.MEM_7(3), .MEM_9(7)>
> 135 if (_2 < c_5)
> 136 goto <bb 8>; [INV]
> 137 else
> 138 goto <bb 9>; [INV]
> 139 ;; succ: 8 (TRUE_VALUE,EXECUTABLE)
> 140 ;; 9 (FALSE_VALUE,EXECUTABLE)
>
> Code in :
> 4276
> 4277 basic_block *body = get_loop_body (loop);
> 4278 exits = get_loop_exit_edges (loop, body);
> 4279 likely_exit = single_likely_exit (loop, exits);
> 4280 FOR_EACH_VEC_ELT (exits, i, ex)
> 4281 {
> 4282 if (ex == likely_exit)
> 4283 {
> 4284 gimple *stmt = last_stmt (ex->src);
> 4285 if (stmt != NULL)
> 4286 {
>
> gets three exit edges, one of which is <bb4 -> bb1>, as a result, 0 niter is
> computed for this exit in function number_of_iterations_exit_assumptions.
> This seems strange, is it a fake edge added for some reason?
>
> Thanks
Right, it's added by connect_infinite_loops_to_exit.