https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106155
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue here is that we see <bb 3> [local count: 805306369]: # emax_41 = PHI <emax_9(9), emax_22(D)(2)> # ivtmp.7_44 = PHI <ivtmp.7_45(9), 0(2)> i_46 = (int) ivtmp.7_44; if (i_46 == 2) goto <bb 4>; [12.49%] // init else goto <bb 10>; [87.51%] ... <bb 7> [local count: 805306369]: fh.1_6 = fh; f4 (fh.1_6); e.2_7 = e; *e.2_7 = 0; f1 (); if (ivtmp.7_44 == 2) goto <bb 8>; [12.49%] // use else goto <bb 9>; [87.51%] and the predicates i_46 == 2 and ivtmp.7_44 == 2 do not match up. Oh, and my r13-2149-g200baf7698a100 change made us run into if (dominated_by_p (CDI_POST_DOMINATORS, def_bb, use_bb)) /* The use is not guarded. */ return false; for this use on the loop exit because post-dominance doesn't cover loop exit conditions. I will think about this a bit more. I'll also note it is a missed optimization to not replace the i_46 == 2 check. -fno-ivopts makes the warning disappear (when the above is fixed). For some reason we do not optimize the i_46 = (int) ivtmp.7_44; if (i_46 == 2) stmt, likely because ivtmp is 64bit while i is 32bit and we don't check ivtmps value range here.