forked from OSchip/llvm-project
Attributes noinline alwaysinline are incompatible
llvm-svn: 56939
This commit is contained in:
parent
3aa89a971d
commit
9cc9812653
|
@ -60,10 +60,11 @@ const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
|
|||
const Attributes VarArgsIncompatible = StructRet;
|
||||
|
||||
/// @brief Attributes that are mutually incompatible.
|
||||
const Attributes MutuallyIncompatible[3] = {
|
||||
const Attributes MutuallyIncompatible[4] = {
|
||||
ByVal | InReg | Nest | StructRet,
|
||||
ZExt | SExt,
|
||||
ReadNone | ReadOnly
|
||||
ReadNone | ReadOnly,
|
||||
NoInline | AlwaysInline
|
||||
};
|
||||
|
||||
/// @brief Which attributes cannot be applied to a type.
|
||||
|
|
|
@ -475,6 +475,23 @@ void Verifier::VerifyFunctionAttrs(const FunctionType *FT,
|
|||
if (Attr.Attrs & Attribute::StructRet)
|
||||
Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
|
||||
}
|
||||
|
||||
Attributes FAttrs = Attrs.getFnAttributes();
|
||||
for (unsigned i = 0;
|
||||
i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
|
||||
Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i];
|
||||
Assert1(!(MutI & (MutI - 1)), "Attributes " +
|
||||
Attribute::getAsString(MutI) + " are incompatible!", V);
|
||||
}
|
||||
|
||||
Attributes RAttrs = Attrs.getRetAttributes();
|
||||
for (unsigned i = 0;
|
||||
i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
|
||||
Attributes MutI = RAttrs & Attribute::MutuallyIncompatible[i];
|
||||
Assert1(!(MutI & (MutI - 1)), "Attributes " +
|
||||
Attribute::getAsString(MutI) + " are incompatible!", V);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool VerifyAttributeCount(const AttrListPtr &Attrs, unsigned Params) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
; Test function notes
|
||||
; RUN: not llvm-as %s -o /dev/null -f |& grep "only one inline note"
|
||||
; XFAIL: *
|
||||
; RUN: not llvm-as %s -o /dev/null -f |& grep "Attributes noinline alwaysinline are incompatible"
|
||||
define void @fn1() alwaysinline noinline {
|
||||
ret void
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue