[LLVMdev] [cfe-dev] Extend llvm to fix global addresses
David A. Greene
greened at obbligato.org
Mon Dec 12 09:20:13 PST 2011
Dan Gohman <gohman at apple.com> writes:
>> But anything which avoids the horrible int* cast has to be a good
>> thing. For one thing it would cause alias analysis a lot of pain.
> Actually, it wouldn't cause very much pain, if any, in alias analysis.
> LLVM IR already assumes that programmers can't "guess" what the
> address of the stack, global variables, or heap will be. An integer
> constant casted to a pointer is assumed to be non-aliasing with
> "regular" objects in memory.
> I don't mean to shoot you down, but there don't seem to be any
> compelling motivations for this feature.
I agree. We make use of this property to turn some pretty ugly frontend
pointer arithmetic using integers into somewhat less ugly GEP operations
which LLVM can understand.
So ptrtoint/inttoptr isn't really a problem as long as you know it's
More information about the llvm-dev