aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AsmParser/LLParser.cpp6
-rw-r--r--test/DebugInfo/2009-11-16-Phi.ll13
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 09bc5f736f..1e1ddf07d2 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -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
index 0000000000..fc0375186d
--- /dev/null
+++ b/test/DebugInfo/2009-11-16-Phi.ll
@@ -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