Check that sret is only used on pointers to types
with a size, like byval.
llvm-svn: 46207
diff --git a/llvm/lib/VMCore/ParameterAttributes.cpp b/llvm/lib/VMCore/ParameterAttributes.cpp
index 4b63cfb..0cafd30 100644
--- a/llvm/lib/VMCore/ParameterAttributes.cpp
+++ b/llvm/lib/VMCore/ParameterAttributes.cpp
@@ -202,8 +202,8 @@
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
if (!PTy->getElementType()->isSized())
- // The byval attribute only applies to pointers to types with a size.
- Incompatible |= ParamAttr::ByVal;
+ // The byval and sret attributes only apply to pointers to sized types.
+ Incompatible |= ByVal | StructRet;
} else {
// Attributes that only apply to pointers.
Incompatible |= ByVal | Nest | NoAlias | StructRet;