[NFC][OpaquePtr] Make getMemoryParamAllocType() compatible with opaque pointers

These ABI attributes now always require the type parameter.

sret was missing from the first set of checks but was covered by the
second set.
This commit is contained in:
Arthur Eubanks 2021-06-11 15:59:20 -07:00
parent 1c51bf3b78
commit 37a2c4517b
1 changed files with 2 additions and 8 deletions

View File

@ -169,14 +169,8 @@ static Type *getMemoryParamAllocType(AttributeSet ParamAttrs, Type *ArgTy) {
return PreAllocTy;
if (Type *InAllocaTy = ParamAttrs.getInAllocaType())
return InAllocaTy;
// FIXME: sret and inalloca always depends on pointee element type. It's also
// possible for byval to miss it.
if (ParamAttrs.hasAttribute(Attribute::InAlloca) ||
ParamAttrs.hasAttribute(Attribute::ByVal) ||
ParamAttrs.hasAttribute(Attribute::StructRet) ||
ParamAttrs.hasAttribute(Attribute::Preallocated))
return cast<PointerType>(ArgTy)->getElementType();
if (Type *SRetTy = ParamAttrs.getStructRetType())
return SRetTy;
return nullptr;
}