[LLVMdev] loads from a null address and optimizations

John McCall rjmccall at apple.com
Sat Sep 5 15:48:46 PDT 2009


Zoltan Varga wrote:
> Hi,
>
>   I don't intentionally want to induce a tramp, the load null is 
> created by an llvm optimization
> pass from code like:
>    v = null;
>    .....
>    v.Call ();

This is more of a workaround than a solution, but have you tried 
emitting null as inttoptr(0) instead of a ConstantPointerNull?  That 
should disable optimizations relying on C-like undefined behavior 
semantics, at least as long as there isn't some pass which recognizes 
that pattern and turns it back into null.

John.



More information about the llvm-dev mailing list