https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91540
Bug ID: 91540 Summary: Missed optimization: simplification CFG Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zamazan4ik at tut dot by Target Milestone: --- For the code below: int Test(bool cond1, bool cond2) { if (cond1) { if (cond2) { return 42; } } return 43; } gcc(trunk) with '-O3' produces: Test(bool, bool): test dil, dil je .L3 test sil, sil jne .L5 .L3: mov eax, 43 ret .L5: mov eax, 42 ret clang(trunk) with '-O3' produces: Test(bool, bool): # @Test(bool, bool) mov eax, edi and eax, esi xor eax, 43 ret I think GCC can do it better.