https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100922
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-06-05 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Pre takes: <bb 5> [local count: 1073741824]: # str_9 = PHI <str_27(4), str_16(8)> # out_10 = PHI <str_27(4), out_20(8)> str_16 = str_9 + 1; c_17 = *str_9; _5 = (sizetype) c_17; _6 = keep_lut_14(D) + _5; inc_18 = *_6; *out_10 = c_17; _7 = (sizetype) inc_18; out_20 = out_10 + _7; if (c_17 != 0) goto <bb 8>; [89.00%] else goto <bb 6>; [11.00%] <bb 8> [local count: 955630224]: goto <bb 5>; [100.00%] Changes it to: <bb 5> [local count: 1073741824]: # str_9 = PHI <str_27(4), str_16(6)> # out_10 = PHI <str_27(4), out_20(6)> # prephitmp_60 = PHI <prephitmp_54(4), pretmp_59(6)> str_16 = str_9 + 1; c_17 = *str_9; _5 = (sizetype) c_17; _6 = keep_lut_14(D) + _5; *out_10 = c_17; _7 = (sizetype) prephitmp_60; out_20 = out_10 + _7; if (c_17 != 0) goto <bb 6>; [89.00%] else goto <bb 7>; [11.00%] <bb 6> [local count: 955630224]: pretmp_55 = MEM[(char *)str_9 + 1B]; _57 = (sizetype) pretmp_55; _58 = keep_lut_14(D) + _57; pretmp_59 = *_58; goto <bb 5>; [100.00%] And then ch_vect changes it to (basically undoing the PRE): <bb 14> [local count: 850510900]: <bb 6> [local count: 955630224]: # str_42 = PHI <str_41(14), str_27(13)> # str_41 = PHI <str_16(14), str_47(13)> # out_38 = PHI <out_20(14), out_43(13)> pretmp_55 = MEM[(char *)str_42 + 1B]; _57 = (sizetype) pretmp_55; _58 = keep_lut_14(D) + _57; pretmp_59 = *_58; str_16 = str_41 + 1; c_17 = *str_41; *out_38 = c_17; _7 = (sizetype) pretmp_59; out_20 = out_38 + _7; if (c_17 != 0) goto <bb 14>; [89.00%] else goto <bb 7>; [11.00%] And then IVOPTS comes around and does: <bb 14> [local count: 850510900]: <bb 6> [local count: 955630224]: # str_41 = PHI <str_16(14), str_47(13)> # out_38 = PHI <out_20(14), out_43(13)> pretmp_55 = MEM[(char *)str_41]; _57 = (sizetype) pretmp_55; _58 = keep_lut_14(D) + _57; pretmp_59 = *_58; str_16 = str_41 + 1; c_17 = MEM[(char *)str_16 + -1B]; *out_38 = c_17; _7 = (sizetype) pretmp_59; out_20 = out_38 + _7; if (c_17 != 0) goto <bb 14>; [89.00%] else goto <bb 7>; [11.00%] Which is fine except FRE (and DOM), don't recognize the MEM[(char *)str_16 + -1B] and MEM[(char *)str_41] being the same. For FRE, it almost looks like TARGET_MEM_REF is not handled ....