[llvm-commits] [cfe-commits] [PATCH][RFC] PR10367: don't allow GlobalAlias's aliasee to be an arbitrary Constant
Duncan Sands
baldrick at free.fr
Sun Jul 31 00:58:33 PDT 2011
Hi Jay,
>>>> 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.
LLVM has a very regular type system. By introducing alias as a special
exception where types don't have to match you make LLVM IR less regular
which is bad. For the sake of saving a few bitcasts you are increasing
the number of concepts: "entities must not be multiplied beyond necessity".
> Currently this has to be done by callers of GlobalAlias::setAliasee,
> which is an unnecessary burden on them.
I think a better solution is to introduce a helper function for front-end
writers which takes care of this kind of detail for them.
Ciao, Duncan.
More information about the llvm-commits
mailing list