https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107087
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Huh. <bb 14> [local count: 226234232]: _634 = _76 + _546; _618 = -12; if (_618 > 4) goto <bb 15>; [90.00%] else goto <bb 16>; [10.00%] left around by t.ii.204t.forwprop4 _634 = _76 + _546; - _618 = 8 - prephitmp_260; + _618 = -12; if (_618 > 4) and this constant is produced by cleanup_cfg via replace_uses_by which replaces prephitmp_260 with 20 and folds the stmt when merging blocks 30 and 36. If we'd realize the condition would be false we wouldn't emit the bad diagnostics. Note it's the very last forwprop and there's no copy propagation done afterwards. IMHO even CFG cleanup propagating to uses instead of replacing the PHI with a copy is premature, so asking for it to propagate even further there is wrong I think. forwprop could eventually be taught to track known not executable edges in its non-iterating RPO walk and so eventually optimize the copy itself. The testcase has no loops at least. Let me try.