>> Yes, basically replace dyn_cast with cast in the users. I was going to
>> do it in a followup patch, but there are not that many users, so I
>> included it in the attached one.
>
>
> You forgot to have the verifier complain if the type is not an array type!

There is already a check for only arrays having appending linkage. I
added a test to make sure it stays that way.

>> Not sure. That would require every user to check for
>> ConstantAggregateZero.
>
>
> Don't they just loop over the array index range and do stuff per index, in
> which
> case this wouldn't be a problem (empty loop)?

Unfortunately no,  ConstantAggregateZero inherits from Constant, not
ConstantArray, so they would need a dyn_cast.

>> +  if (GV.hasName() && (GV.getName() == "llvm.used")) {
>> +    Assert1(!GV.hasInitializer() || GV.hasAppendingLinkage(),
>> +            "invalid linkage for intrinsic global variable", &GV);
>> +    Type *GVType = cast<PointerType>(GV.getType())->getElementType();
>
>
> The cast shouldn't be needed as if GV is a GlobalValue then getType is
> tweaked
> to return PointerType.

Updated, thanks.

New patch is attached.

Cheers,
Rafael

Attachment: t.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to