On Thursday, 23 April 2015 at 08:33:56 UTC, John Colvin wrote:
Why can no compiler I try optimise this toy example as I would
expect?
// uncomment if using a C compiler
// typedef unsigned int uint;
uint foo(uint a)
{
if (a < 5)
return (a * 3) / 3;
else
return 0;
}
It is interesting to see how things do get optimized when e.g. changing the multiply * into a plus +.
