[Bitcode] Move x86_intrcc upgrade to bitcode reader

This upgrade requires access the legacy pointer element type, so
it needs to happen inside the bitcode reader.
This commit is contained in:
Nikita Popov
2022-03-04 10:30:50 +01:00
parent e3a9f68e2c
commit 7a258c6a37
3 changed files with 20 additions and 8 deletions

View File

@@ -3601,6 +3601,16 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
}
}
if (Func->getCallingConv() == CallingConv::X86_INTR &&
!Func->arg_empty() && !Func->hasParamAttribute(0, Attribute::ByVal)) {
unsigned ParamTypeID = getContainedTypeID(FTyID, 1);
Type *ByValTy = getPtrElementTypeByID(ParamTypeID);
if (!ByValTy)
return error("Missing param element type for x86_intrcc upgrade");
Attribute NewAttr = Attribute::getWithByValType(Context, ByValTy);
Func->addParamAttr(0, NewAttr);
}
MaybeAlign Alignment;
if (Error Err = parseAlignmentValue(Record[5], Alignment))
return Err;