Parse PHI instruction with attached metadata.
authorDevang Patel <dpatel@apple.com>
Fri, 16 Oct 2009 18:45:49 +0000 (18:45 +0000)
committerDevang Patel <dpatel@apple.com>
Fri, 16 Oct 2009 18:45:49 +0000 (18:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84264 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/LLParser.cpp
test/DebugInfo/2009-11-16-Phi.ll [new file with mode: 0644]

index 09bc5f736fc610d895dd74ad1f21c269508c8876..1e1ddf07d2e5e45419e2728e294abd630999430d 100644 (file)
@@ -3315,6 +3315,9 @@ bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
     if (!EatIfPresent(lltok::comma))
       break;
 
+    if (Lex.getKind() == lltok::NamedOrCustomMD)
+      break;
+
     if (ParseToken(lltok::lsquare, "expected '[' in phi value list") ||
         ParseValue(Ty, Op0, PFS) ||
         ParseToken(lltok::comma, "expected ',' after insertelement value") ||
@@ -3323,6 +3326,9 @@ bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
       return true;
   }
 
+  if (Lex.getKind() == lltok::NamedOrCustomMD)
+    if (ParseOptionalCustomMetadata()) return true;
+
   if (!Ty->isFirstClassType())
     return Error(TypeLoc, "phi node must have first class type");
 
diff --git a/test/DebugInfo/2009-11-16-Phi.ll b/test/DebugInfo/2009-11-16-Phi.ll
new file mode 100644 (file)
index 0000000..fc03751
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -disable-output
+
+define i32 @foo() {
+E:
+   br label %B2
+B1:
+   br label %B2
+B2:
+   %0 = phi i32 [ 0, %E ], [ 1, %B1 ], !dbg !0
+   ret i32 %0
+}
+
+!0 = metadata !{i32 42}
\ No newline at end of file