http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56610
Bug #: 56610 Summary: IPA(-CP) clone materialization fails to cleanup the CFG Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org CC: hubi...@gcc.gnu.org __attribute__((noinline)) static int foo (int x) { int i = 1; if (x > 1) do bar (i); while (++i != x); } void baz (void) { foo (1); foo (1); foo (1); } We can see a if (1 == 0) survive for a long time. When IPA-CP get's the chance to look at the clones body in ipcp_transform_function there is nothing that changes the CFG and thus it doesn't queue a cfg-cleanup to fix up the above (which is created by clone materialization itself). Now we can just unconditionally schedule a cfg-cleanup after IPA-CP, but really all those "todo"s should queue up for all IPA transforms (including fixup-cfg, which should be a IPA transform-only pass in the IPA pipeline).