https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76957
--- Comment #9 from amker at gcc dot gnu.org --- (In reply to amker from comment #8) > I will have a look. Thanks. Tree dump is as below: ;; Function dsyr2k (dsyr2k, funcdef_no=0, decl_uid=4135, cgraph_uid=0, symbol_order=3) dsyr2k (long int N) { int k; int j; int i; double _1; double _9; <bb 2> [0.47%]: if (N_17(D) > 0) goto <bb 3>; [85.00%] else goto <bb 12>; [15.00%] <bb 3> [0.40%]: goto <bb 11>; [100.00%] <bb 4> [12.75%]: <bb 5> [15.00%]: # j_3 = PHI <j_19(4), 0(11)> <bb 6> [85.00%]: # k_22 = PHI <k_21(7), j_3(5)> _1 = c[j_3][k_22]; _9 = _1 + 0.0; c[j_3][k_22] = _9; k_21 = k_22 + 1; if (N_17(D) > k_21) goto <bb 7>; [82.35%] else goto <bb 8>; [17.65%] <bb 7> [70.00%]: goto <bb 6>; [100.00%] <bb 8> [15.00%]: j_19 = j_3 + 1; if (N_17(D) > j_19) goto <bb 4>; [85.00%] else goto <bb 9>; [15.00%] <bb 9> [2.65%]: i_18 = i_8 + 1; if (N_17(D) > i_18) goto <bb 10>; [85.00%] else goto <bb 12>; [15.00%] <bb 10> [2.25%]: <bb 11> [2.65%]: # i_8 = PHI <i_18(10), 0(3)> goto <bb 5>; [100.00%] <bb 12> [0.47%]: return; } the information is already there that (long int)j_3 >= N_17(D) is always false: # j_3 = PHI <j_19(4), 0(11)> and we have dominant condition for both PHI arguments: if (N_17(D) > j_19) and if (N_17(D) > 0) We just need to find a way to use it. It would be easy to fix if we have flow-sensitive value range, and support symbolic range better in VRP. Which we don't have either one for now. Another choice is to improve simplify_using_initial_conditions or simplify_using_outer_evolutions. Function fact simplify_using_outer_evolutions doesn't help at all in this case.