For void foo (int x, int *y, int *z) { *z = ++x; if (x != 0) *y = 1; }
gcc 4.3 generates foo: .LFB2: addl $1, %edi testl %edi, %edi movl %edi, (%rdx) je .L3 movl $1, (%rsi) .L3: rep ; ret But "testl %edi, %edi" isn't needed since "addl $1, %edi" sets proper FLAGS_REG. -- Summary: Failed to optimize out test instruction Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hjl at lucon dot org GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31799