[llvm-commits] [llvm] r85921 - in /llvm/trunk: lib/AsmParser/LLParser.cpp test/DebugInfo/2009-11-03-InsertExtractValue.ll

Devang Patel dpatel at apple.com
Tue Nov 3 11:06:07 PST 2009


Author: dpatel
Date: Tue Nov  3 13:06:07 2009
New Revision: 85921

URL: http://llvm.org/viewvc/llvm-project?rev=85921&view=rev
Log:
Parse debug info attached with insertvalue and extractvalue instructions.

Added:
    llvm/trunk/test/DebugInfo/2009-11-03-InsertExtractValue.ll
Modified:
    llvm/trunk/lib/AsmParser/LLParser.cpp

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=85921&r1=85920&r2=85921&view=diff

==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Nov  3 13:06:07 2009
@@ -1137,6 +1137,8 @@
     return TokError("expected ',' as start of index list");
 
   while (EatIfPresent(lltok::comma)) {
+    if (Lex.getKind() == lltok::NamedOrCustomMD)
+      break;
     unsigned Idx;
     if (ParseUInt32(Idx)) return true;
     Indices.push_back(Idx);
@@ -2111,6 +2113,9 @@
         ParseIndexList(Indices) ||
         ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr"))
       return true;
+    if (Lex.getKind() == lltok::NamedOrCustomMD)
+      if (ParseOptionalCustomMetadata()) return true;
+
     if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
       return Error(ID.Loc, "extractvalue operand must be array or struct");
     if (!ExtractValueInst::getIndexedType(Val->getType(), Indices.begin(),
@@ -2132,6 +2137,8 @@
         ParseIndexList(Indices) ||
         ParseToken(lltok::rparen, "expected ')' in insertvalue constantexpr"))
       return true;
+    if (Lex.getKind() == lltok::NamedOrCustomMD)
+      if (ParseOptionalCustomMetadata()) return true;
     if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
       return Error(ID.Loc, "extractvalue operand must be array or struct");
     if (!ExtractValueInst::getIndexedType(Val0->getType(), Indices.begin(),
@@ -3737,6 +3744,8 @@
   if (ParseTypeAndValue(Val, Loc, PFS) ||
       ParseIndexList(Indices))
     return true;
+  if (Lex.getKind() == lltok::NamedOrCustomMD)
+    if (ParseOptionalCustomMetadata()) return true;
 
   if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
     return Error(Loc, "extractvalue operand must be array or struct");
@@ -3758,6 +3767,8 @@
       ParseTypeAndValue(Val1, Loc1, PFS) ||
       ParseIndexList(Indices))
     return true;
+  if (Lex.getKind() == lltok::NamedOrCustomMD)
+    if (ParseOptionalCustomMetadata()) return true;
 
   if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
     return Error(Loc0, "extractvalue operand must be array or struct");

Added: llvm/trunk/test/DebugInfo/2009-11-03-InsertExtractValue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-11-03-InsertExtractValue.ll?rev=85921&view=auto

==============================================================================
--- llvm/trunk/test/DebugInfo/2009-11-03-InsertExtractValue.ll (added)
+++ llvm/trunk/test/DebugInfo/2009-11-03-InsertExtractValue.ll Tue Nov  3 13:06:07 2009
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+!0 = metadata !{i32 42}
+
+define <{i32, i32}> @f1() {
+; CHECK: !dbg !0
+  %r = insertvalue <{ i32, i32 }> zeroinitializer, i32 4, 1, !dbg !0
+; CHECK: !dbg !0
+  %e = extractvalue <{ i32, i32 }> %r, 0, !dbg !0
+  ret <{ i32, i32 }> %r
+}





More information about the llvm-commits mailing list