Re: [-mm patch] make kcalloc() a static inline

From: Arjan van de Ven
Date: Mon Aug 15 2005 - 04:42:44 EST


On Mon, 2005-08-15 at 12:33 +0300, Denis Vlasenko wrote:

> gcc can optimize that away with non-const n?! I don't think so.

due to the wonders of "value range propagation" it actually can, if the
check is done sufficiently before...

gcc keeps track of the range a variable can have at each point, so if
the check is done before, the "possible range" will be such that the
divide should be optimizable.

(Note: this is a relatively new feature in gcc though)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/