summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-08-17 11:32:21 +0000
committerDavide Italiano <davide@freebsd.org>2017-08-17 11:32:21 +0000
commit903fd3ea4e3c10dc27428a763516ce992c935ec1 (patch)
treeb68f2d742f2310c431c9b5b200bd9280e3d77699
parent8a2c07f6d42f300b44318e4350a324ef966894d5 (diff)
downloadbcm5719-llvm-903fd3ea4e3c10dc27428a763516ce992c935ec1.tar.gz
bcm5719-llvm-903fd3ea4e3c10dc27428a763516ce992c935ec1.zip
[Verifier] Avoid visiting DIGlobalVariables twice.
We currently visit them twice. Once, through `visitMDNode()` -> (the code generated by) `../include/llvm/IR/Metadata.def:109` -> `visitDIGlobalVariable()` Then, through `visitMDNode()` -> `visitDIGlobalVariableExpression()` -> `visitDIGlobalVariable()` This results in verification failures printed twice, e.g.: $ ./opt -verify ../../test/DebugInfo/pr34186.ll missing global variable type !4 = distinct !DIGlobalVariable(name: "pat", scope: !0, file: !1, line: 27, isLocal: true, isDefinition: true) missing global variable type !4 = distinct !DIGlobalVariable(name: "pat", scope: !0, file: !1, line: 27, isLocal: true, isDefinition: true) ./opt: ../../test/DebugInfo/pr34186.ll: error: input module is broken! The patch removes one call so we ensure each GV is visited exactly once. Differential Revision: https://reviews.llvm.org/D36797 llvm-svn: 311081
-rw-r--r--llvm/lib/IR/Verifier.cpp2
-rw-r--r--llvm/test/DebugInfo/pr34186.ll2
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index d08b69fd4aa..c4ae3bb0a4b 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1173,8 +1173,6 @@ void Verifier::visitDIExpression(const DIExpression &N) {
void Verifier::visitDIGlobalVariableExpression(
const DIGlobalVariableExpression &GVE) {
AssertDI(GVE.getVariable(), "missing variable");
- if (auto *Var = GVE.getVariable())
- visitDIGlobalVariable(*Var);
if (auto *Expr = GVE.getExpression())
visitDIExpression(*Expr);
}
diff --git a/llvm/test/DebugInfo/pr34186.ll b/llvm/test/DebugInfo/pr34186.ll
index 63d750659d1..594cf96b04b 100644
--- a/llvm/test/DebugInfo/pr34186.ll
+++ b/llvm/test/DebugInfo/pr34186.ll
@@ -1,5 +1,7 @@
+; Make sure we reject GVs without a type and we verify each exactly once.
; RUN: not llc %s 2>&1 | FileCheck %s
; CHECK: missing global variable type
+; CHECK-NOT: missing global variable type
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!63, !64}
OpenPOWER on IntegriCloud