[llvm] r233095 - Verifier: Start recursing into !dbg attachments

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Mar 24 10:32:19 PDT 2015


Author: dexonsmith
Date: Tue Mar 24 12:32:19 2015
New Revision: 233095

URL: http://llvm.org/viewvc/llvm-project?rev=233095&view=rev
Log:
Verifier: Start recursing into !dbg attachments

The main verifier already recurses through the other entry points, so we
might as well descend here too.

This temporarily duplicates some work already done in
`verifyDebugInfo()`, but eventually I'll be removing the other side.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp
    llvm/trunk/test/Verifier/dbg.ll

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=233095&r1=233094&r2=233095&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Tue Mar 24 12:32:19 2015
@@ -2567,11 +2567,9 @@ void Verifier::visitInstruction(Instruct
            &I);
   }
 
-  // Don't recurse into !dbg attachments (leave that for verifyDebugInfo()),
-  // but at least check that it's a legal type.
   if (MDNode *N = I.getDebugLoc().getAsMDNode()) {
-    Assert(isa<MDLocation>(N),
-           "invalid !dbg metadata attachment", &I, N);
+    Assert(isa<MDLocation>(N), "invalid !dbg metadata attachment", &I, N);
+    visitMDNode(*N);
   }
 
   InstsInThisBlock.insert(&I);

Modified: llvm/trunk/test/Verifier/dbg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/dbg.ll?rev=233095&r1=233094&r2=233095&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/dbg.ll (original)
+++ llvm/trunk/test/Verifier/dbg.ll Tue Mar 24 12:32:19 2015
@@ -1,12 +1,18 @@
 ; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
 
 define void @foo() {
-  ret void, !dbg !{}
-}
+entry:
+  br label %exit, !dbg !MDLocation(scope: !MDSubprogram(), inlinedAt: !{})
+; CHECK: inlined-at should be a location
+; CHECK-NEXT: !{{[0-9]+}} = !MDLocation(line: 0, scope: !{{[0-9]+}}, inlinedAt: ![[IA:[0-9]+]])
+; CHECK-NEXT: ![[IA]] = !{}
 
+exit:
+  ret void, !dbg !{}
 ; CHECK: invalid !dbg metadata attachment
 ; CHECK-NEXT: ret void, !dbg ![[LOC:[0-9]+]]
 ; CHECK-NEXT: ![[LOC]] = !{}
+}
 
 !llvm.module.flags = !{!0}
 !0 = !{i32 2, !"Debug Info Version", i32 3}





More information about the llvm-commits mailing list