4 ms·
When compiling code like if a > b b = a continue else continue you can replace the entire if-else with a cmov. but if there is a function call
by anonymoushn 3y ago
When compiling code like
if a > b
b = a
continue
else
continue
you can replace the entire if-else with a cmov. but if there is a function call in one of the prongs and not in the other, you cannot.
- mcv 3y agoAh, so it's the function call (which could just as easily have been something other than print), that forces the compiler to use a normally-less-optimal branch rather than the normally-more-optimal cmov. Only in this particular use case, cmov is actually less optimal, but the compiler doesn't know that.