[llvm-commits] [llvm] r117070 - /llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp

Duncan Sands baldrick at free.fr
Sat Oct 23 05:08:07 PDT 2010


Hi Dan,

>> Both C and C++ say that modifying an object defined with a const qualifier
>> has undefined results, so while you can't use this for pointer-to-const, you
>> could use it for const variables after they've been initialized.
>
>
> For pointsToConstantMemory, it has to be really constant, so in C, the only
> thing that could use it is statically initialized const variables.
>
> LLVM already has constant GlobalVariables, so probably the only new
> theoretical functionality here for C and C++ would be for statically initialized
> objects which are mostly const but have mutable fields.
>
> For other languages, this feature could be used for runtime library calls
> which allocate objects and initialize some thereafter-constant fields in
> the objects, as long as the calls are never inlined.

this sounds a lot like what you can do with llvm.invariant (initialize a
variable, then mark it as constant afterwards using llvm.invariant).

Ciao,

Duncan.



More information about the llvm-commits mailing list