summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-02-18 03:02:44 +0000
committerDavide Italiano <davide@freebsd.org>2017-02-18 03:02:44 +0000
commit982bf827b57a727ceeec9bd34c25ccb2b0133a9d (patch)
tree896e1b4f76d1d2a23bf364a97c068c3038d837c7
parentbd4cd0c063ca432f4cca52c331fadd58abfb8b2e (diff)
downloadbcm5719-llvm-982bf827b57a727ceeec9bd34c25ccb2b0133a9d.tar.gz
bcm5719-llvm-982bf827b57a727ceeec9bd34c25ccb2b0133a9d.zip
[IR/Verifier] Don't visit DISubprograms more than needed.
Before this patch we happened to visit twice, one when scanning MDNodes and the other one while visiting the function. Remove the explicit call to visitDISubprogram there, so we don't emit the same error twice in case the verifier fail and we save some time when running it. Thanks to Justin Bogner for the report and Adrian for the quick review! PR: 31995 llvm-svn: 295537
-rw-r--r--llvm/lib/IR/Verifier.cpp2
-rw-r--r--llvm/test/DebugInfo/Generic/invalid.ll17
2 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 9c2da10c9e1..c14e2bbdee4 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2119,8 +2119,6 @@ void Verifier::visitFunction(const Function &F) {
if (!N)
return;
- visitDISubprogram(*N);
-
// Check that all !dbg attachments lead to back to N (or, at least, another
// subprogram that describes the same function).
//
diff --git a/llvm/test/DebugInfo/Generic/invalid.ll b/llvm/test/DebugInfo/Generic/invalid.ll
new file mode 100644
index 00000000000..fdb68d9cca3
--- /dev/null
+++ b/llvm/test/DebugInfo/Generic/invalid.ll
@@ -0,0 +1,17 @@
+; RUN: not opt -verify %s 2>&1 | FileCheck %s
+
+; Make sure we emit this diagnostic only once (which means we don't visit the
+; same DISubprogram twice.
+; CHECK: subprogram definitions must have a compile unit
+; CHECK-NEXT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
+; CHECK-NOT: subprogram definitions must have a compile unit
+; CHECK-NOT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
+
+define void @tinkywinky() !dbg !3 { ret void }
+
+!llvm.module.flags = !{!4}
+!llvm.dbg.cu = !{!0}
+!0 = distinct !DICompileUnit(language: 12, file: !1)
+!1 = !DIFile(filename: "/home/davide", directory: "/home/davide")
+!3 = distinct !DISubprogram(name: "patatino", isDefinition: true)
+!4 = !{i32 2, !"Debug Info Version", i32 3}
OpenPOWER on IntegriCloud