[llvm-commits] patch: treat selector ref globals as constant in MachineLICM

Peter Cooper peter_cooper at apple.com
Thu Nov 3 10:26:41 PDT 2011


Hi Duncan

Yeah, i need the internal linkage.  The problem with marking this global as constant is that it actually has a value at compile time, just that the compile time value may get changed by the linker/runtime.  But if you make it constant then the optimizer substitutes the load from the global for the value the compiler sees it contains.

So yeah, i need something like WeakInternalConstant

Pete

On Nov 3, 2011, at 2:03 AM, Duncan Sands wrote:

> Hi Peter,
> 
>> Please review this patch to allow the compiler to treat objc selector reference globals as constant when optimizing.  These globals aren't actually constant at compile time in that the value they point at may be changed by the linker or runtime, but the value they have is the same for all loads from that address once the program has started.
> 
> what if you declare the global to be a weak constant?  I guess the problem is
> that you need internal linkage?
> 
> Ciao, Duncan.
> 
>> Ideally this code shouldn't be checking for the name of the global, but the correct change likely involves adding a new linkage type which is much more significant and overkill while there's only one type of variable this applies to.
>> 
>> Thanks,
>> Pete
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list