Filed under unknown since there is no version tag for the tree-cleanup-branch. The problem probably also exists on mainline, but I have not tried it there.
Consider this code, ----------------------------------------------------- extern void foo (void); extern int i; void bar (void) { switch (i) { case 0: foo (); break; case 1: break; } switch (i) { case 0: foo (); break; case 1: break; } } ----------------------------------------------------- This gives the following .dse2 dump: ;; Function bar (bar) bar () { int i.0; <bb 0>: # VUSE <i_2>; i.0_3 = i; switch (i.0_3) { case 0: goto <L0>; default : goto <L1>; } <L0>:; # i_6 = V_MAY_DEF <i_2>; foo (); # i_1 = PHI <i_2(0), i_6(1)>; <L1>:; # VUSE <i_1>; i.0_4 = i; switch (i.0_4) { case 0: goto <L4>; default : goto <L5>; } <L4>:; # i_5 = V_MAY_DEF <i_1>; foo (); <L5>:; return; } If the first switch goes through the default case, the switch condition "i" is not call clobbered by the call to "foo ()" so in the second switch "i" is unchanged and we can thread the jump. We don't catch this jump threading opportunity on trees, but we *do* catch it on RTL. This is *the* major source of missed jump threads on the tree-cleanup-branch (we catch rougly a thousand of these on the cc1-i file set). If we teach the tree optimizers to catch this case, we can almost certainly kill the RTL thread_jump junk on the tree-cleanup-branch. -- Summary: Missed jump threading optimization Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization, alias, TREE Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steven at gcc dot gnu dot org CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18046