[llvm-commits] [llvm] r84264 - in /llvm/trunk: lib/AsmParser/LLParser.cpp test/DebugInfo/2009-11-16-Phi.ll

Devang Patel dpatel at apple.com
Fri Oct 16 11:45:50 PDT 2009


Author: dpatel
Date: Fri Oct 16 13:45:49 2009
New Revision: 84264

URL: http://llvm.org/viewvc/llvm-project?rev=84264&view=rev
Log:
Parse PHI instruction with attached metadata.

Added:
    llvm/trunk/test/DebugInfo/2009-11-16-Phi.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=84264&r1=84263&r2=84264&view=diff

==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Oct 16 13:45:49 2009
@@ -3315,6 +3315,9 @@
     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 @@
       return true;
   }
 
+  if (Lex.getKind() == lltok::NamedOrCustomMD)
+    if (ParseOptionalCustomMetadata()) return true;
+
   if (!Ty->isFirstClassType())
     return Error(TypeLoc, "phi node must have first class type");
 

Added: llvm/trunk/test/DebugInfo/2009-11-16-Phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-11-16-Phi.ll?rev=84264&view=auto

==============================================================================
--- llvm/trunk/test/DebugInfo/2009-11-16-Phi.ll (added)
+++ llvm/trunk/test/DebugInfo/2009-11-16-Phi.ll Fri Oct 16 13:45:49 2009
@@ -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





More information about the llvm-commits mailing list