Attributes noinline alwaysinline are incompatible

llvm-svn: 56939
This commit is contained in:
Devang Patel 2008-10-01 23:41:25 +00:00
parent 3aa89a971d
commit 9cc9812653
3 changed files with 21 additions and 4 deletions

View File

@ -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.

View File

@ -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) {

View File

@ -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
}