[BitcodeReader] propagateAttributeTypes(): fix opaque pointer handling

Can't get the pointee type of an opaque pointer,
but in that case said attributes must already be typed,
so just don't try to rewrite them if they already are.
This commit is contained in:
Roman Lebedev
2021-12-28 21:58:31 +03:00
parent 48207b2559
commit d5a4d6a497
2 changed files with 63 additions and 23 deletions

View File

@@ -3857,7 +3857,8 @@ void BitcodeReader::propagateAttributeTypes(CallBase *CB,
for (unsigned i = 0; i != CB->arg_size(); ++i) {
for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet,
Attribute::InAlloca}) {
if (!CB->paramHasAttr(i, Kind))
if (!CB->paramHasAttr(i, Kind) ||
CB->getParamAttr(i, Kind).getValueAsType())
continue;
CB->removeParamAttr(i, Kind);