I was messing around with trying to find compile time regressions. The following 3 functions should produce the same asm.
int f0(int c, int a, int b) { if (a == 0 || b == 0) c++; if (a == 0 || b == 0) c++; return c; } int f1(int c,int a, int b) { if (a == 0) goto L1; if (b == 0) goto L1; else goto L5; L1: c++; L5: if (a == 0) goto L2; if (b == 0) goto L2; else goto L3; L2: c++; L3: return c; } int f2(int c,int a, int b) { if (a == 0) goto L1; if (b == 0) goto L1; else goto L5; L1: c+=2; L5: return c; } -- Summary: missed jump threading with || Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18832