I've got a function the gist of which is
if (!cond())
return val;
do {
// logic
} while (cond());
return val;
This looks like it could be simplified as while (cond())
// logic
}
return val;
But if you do you lose out on 20% of performance due to branch mispredictions, and this is a very hot function. It looks like a mistake, like the two are equivalent, but they are actually not. So it gets a comment that explains what's happening.