[llvm-commits] [llvm] r56939 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp test/Assembler/2008-09-02-FunctionNotes2.ll

Devang Patel dpatel at apple.com
Wed Oct 1 16:41:25 PDT 2008


Author: dpatel
Date: Wed Oct  1 18:41:25 2008
New Revision: 56939

URL: http://llvm.org/viewvc/llvm-project?rev=56939&view=rev
Log:
Attributes noinline alwaysinline are incompatible

Modified:
    llvm/trunk/include/llvm/Attributes.h
    llvm/trunk/lib/VMCore/Verifier.cpp
    llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll

Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56939&r1=56938&r2=56939&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Wed Oct  1 18:41:25 2008
@@ -60,10 +60,11 @@
 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.

Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=56939&r1=56938&r2=56939&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Oct  1 18:41:25 2008
@@ -475,6 +475,23 @@
     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) {

Modified: llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll?rev=56939&r1=56938&r2=56939&view=diff

==============================================================================
--- llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll (original)
+++ llvm/trunk/test/Assembler/2008-09-02-FunctionNotes2.ll Wed Oct  1 18:41:25 2008
@@ -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
 }





More information about the llvm-commits mailing list