https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103029
luoxhu at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |luoxhu at gcc dot gnu.org, | |rguenther at suse dot de --- Comment #2 from luoxhu at gcc dot gnu.org --- Confirmed. P7's extra option -mno-allow-movmisalign makes this ICE happens. If add this option on P9 also ICEs. Reason is the phi arguments order changes if switch the sequence of loopify and lv_adjust_loop_entry_edge. the constant input argument from bb 18 is in phi index 1 now makes the followed vectorize code fail to handle? if (_42 != 0) goto <bb 18>; [80.00%] else goto <bb 19>; [20.00%] <bb 18> [local count: 67276368]: <bb 9> [local count: 611603351]: # i_76 = PHI <i_57(10), 1(18)> // here # y_lsm.6_74 = PHI <_61(10), 0.0(18)> // here # w_lsm.7_73 = PHI <_58(10), 0.0(18)> // here i.0_72 = (unsigned int) i_76; _70 = (long unsigned int) i.0_72; _69 = _70 * 80; x_68 = r_22(D) + _69; fpred_67 = x_68->f_pred; fexp_66 = x_68->f_exp; tem_65 = fpred_67 - fexp_66; _64 = x_68->f_sigma; _63 = tem_65 / _64; _62 = ABS_EXPR <_63>; _61 = _62 + y_lsm.6_74; _60 = tem_65 / fexp_66; _59 = ABS_EXPR <_60>; _58 = _59 + w_lsm.7_73; i_57 = i_76 + 1; if (n_19(D) > i_57) goto <bb 10>; [89.00%] else goto <bb 14>; [11.00%] <bb 10> [local count: 544326983]: goto <bb 9>; [100.00%] It was: if (_42 != 0) goto <bb 18>; [80.00%] else goto <bb 19>; [20.00%] <bb 18> [local count: 67276368]: <bb 9> [local count: 611603351]: # i_76 = PHI <1(18), i_57(10)> # y_lsm.6_74 = PHI <0.0(18), _61(10)> # w_lsm.7_73 = PHI <0.0(18), _58(10)> i.0_72 = (unsigned int) i_76; _70 = (long unsigned int) i.0_72; _69 = _70 * 80; x_68 = r_22(D) + _69; fpred_67 = x_68->f_pred; fexp_66 = x_68->f_exp; tem_65 = fpred_67 - fexp_66; _64 = x_68->f_sigma; _63 = tem_65 / _64; _62 = ABS_EXPR <_63>; _61 = _62 + y_lsm.6_74; _60 = tem_65 / fexp_66; _59 = ABS_EXPR <_60>; _58 = _59 + w_lsm.7_73; i_57 = i_76 + 1; if (n_19(D) > i_57) goto <bb 10>; [89.00%] else goto <bb 20>; [11.00%] <bb 10> [local count: 544326983]: goto <bb 9>; [100.00%] The comments in function gimple_lv_adjust_loop_header_phi says /* Browse all 'second' basic block phi nodes and add phi args to edge 'e' for 'first' head. PHI args are always in correct order. */ Any function to fix the phi order?