[llvm-commits] [cfe-commits] [PATCH][RFC] PR10367: don't allow GlobalAlias's aliasee to be an arbitrary Constant

Jay Foad jay.foad at gmail.com
Sat Jul 30 11:19:17 PDT 2011


On 30 July 2011 13:49, Duncan Sands <baldrick at free.fr> wrote:
>>> This patch looks great to me Jay, thanks!
>>
>> I will check it in after all then, if there are no more objections in
>> the next couple of days.
>
> Since we have to accept bitcasts and geps of globals as alias operands,
> is there any point in allowing the result type to be different to the
> operand type?

It saves creating a bitcast ConstantExpr where none is needed.
Currently this has to be done by callers of GlobalAlias::setAliasee,
which is an unnecessary burden on them.

> If we decide that it is better to allow them to differ,
> I reckon we should add a small optimization somewhere that removes any
> bitcasts/geps on alias operands.

Maybe, but I don't really see how that's better than stripping them
off in getAliasee. They should only occur very rarely anyway.

Jay.



More information about the llvm-commits mailing list