https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86132
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2018-06-14 CC| |hubicka at gcc dot gnu.org, | |marxin at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Component|middle-end |ipa Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I see calls to want_foo () which can clobber 'object': <bb 3> [local count: 187153200]: _8 = single_slow (); object = _8; <bb 4> [local count: 1073741824]: # prephitmp_16 = PHI <_8(3), object.1_7(2)> want_foo (prephitmp_16); object.1_4 = object; if (object.1_4 == 0B) goto <bb 5>; [17.43%] else goto <bb 6>; [82.57%] that's the first issue we hit. Then I would expect jump threading to eventually optimize this. I'm not sure returns_nonnull is handled in the required places in optimizers though. I'm not sure why IPA reference doesn't do its job here, it seems to be confused by inlining?