@@ -4086,15 +4086,14 @@ Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) {
4086
4086
4087
4087
Error BitcodeReader::propagateAttributeTypes (CallBase *CB,
4088
4088
ArrayRef<unsigned > ArgTyIDs) {
4089
+ AttributeList Attrs = CB->getAttributes ();
4089
4090
for (unsigned i = 0 ; i != CB->arg_size (); ++i) {
4090
4091
for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet,
4091
4092
Attribute::InAlloca}) {
4092
- if (!CB-> paramHasAttr (i, Kind) ||
4093
- CB-> getParamAttr (i, Kind).getValueAsType ())
4093
+ if (!Attrs. hasParamAttr (i, Kind) ||
4094
+ Attrs. getParamAttr (i, Kind).getValueAsType ())
4094
4095
continue ;
4095
4096
4096
- CB->removeParamAttr (i, Kind);
4097
-
4098
4097
Type *PtrEltTy = getPtrElementTypeByID (ArgTyIDs[i]);
4099
4098
if (!PtrEltTy)
4100
4099
return error (" Missing element type for typed attribute upgrade" );
@@ -4114,7 +4113,7 @@ Error BitcodeReader::propagateAttributeTypes(CallBase *CB,
4114
4113
llvm_unreachable (" not an upgraded type attribute" );
4115
4114
}
4116
4115
4117
- CB-> addParamAttr ( i, NewAttr);
4116
+ Attrs = Attrs. addParamAttribute (Context, i, NewAttr);
4118
4117
}
4119
4118
}
4120
4119
@@ -4125,12 +4124,13 @@ Error BitcodeReader::propagateAttributeTypes(CallBase *CB,
4125
4124
if (!CI.hasArg ())
4126
4125
continue ;
4127
4126
4128
- if (CI.isIndirect && !CB-> getParamElementType (ArgNo)) {
4127
+ if (CI.isIndirect && !Attrs. getParamElementType (ArgNo)) {
4129
4128
Type *ElemTy = getPtrElementTypeByID (ArgTyIDs[ArgNo]);
4130
4129
if (!ElemTy)
4131
4130
return error (" Missing element type for inline asm upgrade" );
4132
- CB->addParamAttr (
4133
- ArgNo, Attribute::get (Context, Attribute::ElementType, ElemTy));
4131
+ Attrs = Attrs.addParamAttribute (
4132
+ Context, ArgNo,
4133
+ Attribute::get (Context, Attribute::ElementType, ElemTy));
4134
4134
}
4135
4135
4136
4136
ArgNo++;
@@ -4140,18 +4140,19 @@ Error BitcodeReader::propagateAttributeTypes(CallBase *CB,
4140
4140
switch (CB->getIntrinsicID ()) {
4141
4141
case Intrinsic::preserve_array_access_index:
4142
4142
case Intrinsic::preserve_struct_access_index:
4143
- if (!CB-> getParamElementType (0 )) {
4143
+ if (!Attrs. getParamElementType (0 )) {
4144
4144
Type *ElTy = getPtrElementTypeByID (ArgTyIDs[0 ]);
4145
4145
if (!ElTy)
4146
4146
return error (" Missing element type for elementtype upgrade" );
4147
4147
Attribute NewAttr = Attribute::get (Context, Attribute::ElementType, ElTy);
4148
- CB-> addParamAttr ( 0 , NewAttr);
4148
+ Attrs = Attrs. addParamAttribute (Context, 0 , NewAttr);
4149
4149
}
4150
4150
break ;
4151
4151
default :
4152
4152
break ;
4153
4153
}
4154
4154
4155
+ CB->setAttributes (Attrs);
4155
4156
return Error::success ();
4156
4157
}
4157
4158
0 commit comments