2 ms·
Basically, yes. The first test and je show the compiler has managed the hard part, but the next je obviously can't be hit, the test after that literally doesn't
by Veedrac 9y ago
Basically, yes. The first test and je show the compiler has managed the hard part, but the next je obviously can't be hit, the test after that literally doesn't do anything, and the two jumps after that also can't be hit. It's funny because this is all so trivial.
If I write it as some C
bool should_jump = edi == 0;
if (should_jump) goto LBB0_5;
if (should_jump) goto LBB0_5;
bool should_jump = edi == 0;
if (should_jump) goto LBB0_5;
if (should_jump) goto LBB0_5;
I can guarantee the compiler is going to produce good code from it.