Read and write function notes.
authorDevang Patel <dpatel@apple.com>
Tue, 2 Sep 2008 21:47:13 +0000 (21:47 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 2 Sep 2008 21:47:13 +0000 (21:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55657 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
test/Assembler/2008-09-02-FunctionNotes.ll

index 79d863833dda9fe7105c6c40cdc090034cc52dcd..0d6b6f2edbe4906fade2d75a10a763ad5fa49705 100644 (file)
@@ -1197,6 +1197,9 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) {
           return Error("Invalid GC ID");
         Func->setGC(GCTable[Record[8]-1].c_str());
       }
+      if (!isProto && Record.size() > 9 && Record[9]) {
+        Func->setNotes(Record[9]);
+      }
       
       ValueList.push_back(Func);
       
index dd161bacfb32a5c63c0c97a9c4f726259e74612b..b8aab5acc19a0902ee95c362259ce47a67bca739 100644 (file)
@@ -412,6 +412,7 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
     Vals.push_back(F->hasSection() ? SectionMap[F->getSection()] : 0);
     Vals.push_back(getEncodedVisibility(F));
     Vals.push_back(F->hasGC() ? GCMap[F->getGC()] : 0);
+    Vals.push_back(F->getNotes());
     
     unsigned AbbrevToUse = 0;
     Stream.EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);
index 2751b6419dae995e76a97896396fcdfa5161b06c..ba886b1a01046b00bf9cda21e750965144680b9b 100644 (file)
@@ -1,5 +1,5 @@
 ; Test function notes
-; RUN: llvm-as < %s -f -o /dev/null
+; RUN: llvm-as < %s | llvm-dis | grep inline | count 2
 
 define void @fn1() notes(inline=always) {
   ret void
@@ -9,3 +9,6 @@ define void @fn2() notes(inline=never) {
   ret void
 }
 
+define void @fn3() {
+  ret void
+}