Add the function attributes from an inline asm call. These don't have declarations...
authorBill Wendling <isanbard@gmail.com>
Wed, 20 Feb 2013 00:04:41 +0000 (00:04 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 20 Feb 2013 00:04:41 +0000 (00:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175577 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/AsmWriter.cpp

index 17d49ac41011a29147c5b1c7af5a524471bc658a..d130a25b2ed748aed55a4a2f2b68256307c16e2e 100644 (file)
@@ -553,6 +553,14 @@ void SlotTracker::processFunction() {
             for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
               if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i)))
                 CreateMetadataSlot(N);
             for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
               if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i)))
                 CreateMetadataSlot(N);
+
+        // Add all the call attributes to the table. This is important for
+        // inline ASM, which may have attributes but no declaration.
+        if (CI->isInlineAsm()) {
+          AttributeSet Attrs = CI->getAttributes().getFnAttributes();
+          if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
+            CreateAttributeSetSlot(Attrs);
+        }
       }
 
       // Process metadata attached with this instruction.
       }
 
       // Process metadata attached with this instruction.