[LLVMdev] [RFC] Alias should not point to declarations

Rafael Espíndola
Wed, 30 Oct 2013 20:29:59 -0000

On 30 October 2013 15:50, Chris Lattner <clattner at apple.com>
wrote:
>
> On Oct 30, 2013, at 12:35 PM, Rafael Espíndola <rafael.espindola at
gmail.com> wrote:
>
>> A long time ago (before r97733) we used to model the weakref attribute
>> by outputting a new declaration and a weak alias to it. This was
>> fairly buggy and we now implement weakref directly in clang, with the
>> same logic an assembler uses to implement .weakref (which is what gcc
>> prints).
>
> This makes sense to me, but I'm not an expert on ELF aliases.
>
> If you're working in this area, there is something that has been
bugging me for years about GlobalAlias: because we require the type of the alias
and aliasee to match, we have to allow constant exprs in the aliasee (see
GlobalAlias::getAliasedGlobal).
>
> This representation is bad for several reasons.  I think it would be much
better to change GlobalAlias to allow the aliasee to have a different type than
the alias itself, and then require the aliasee to be an actual GlobalValue,
disallowing constexprs completely.

This is llvm.org/pr10367, right?

Cheers,
Rafael