[LLVMdev] optimization assumes malloc return is non-null
David Greene
dag at cray.com
Thu May 1 09:47:46 PDT 2008
On Wednesday 30 April 2008 20:01, David Vandevoorde wrote:
> Correct. It's an extreme form of garbage collection, I suppose ;-)
>
> (In theory, it can also be assumed to fail -- because an
> implementation is allowed to make any call to malloc fail -- though
> that's probably not useful.)
You just contradicted yourself. If an implementation can return zero/null,
then the optimizer can't assume the direction of the branch in this case. It
has to allow the call to proceed and get the return value, unless it knows
about the specific implementation of malloc, which shouldn't be the case
for LLVM.
-Dave
More information about the llvm-dev
mailing list