[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
2017-08-17 13:32:21 +02:00
|
|
|
; Make sure we reject GVs without a type and we verify each exactly once.
|
2017-08-16 17:16:33 +02:00
|
|
|
; RUN: not llc %s 2>&1 | FileCheck %s
|
|
|
|
; CHECK: missing global variable type
|
[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
2017-08-17 13:32:21 +02:00
|
|
|
; CHECK-NOT: missing global variable type
|
2017-08-16 17:16:33 +02:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!63, !64}
|
|
|
|
!1 = distinct !DIGlobalVariable(name: "pat", scope: !2, file: !3, line: 27, isLocal: true, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "", emissionKind: FullDebug, globals: !5)
|
|
|
|
!3 = !DIFile(filename: "patatino.c", directory: "/")
|
|
|
|
!5 = !{!6}
|
2017-08-30 20:06:51 +02:00
|
|
|
!6 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
2017-08-16 17:16:33 +02:00
|
|
|
!63 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!64 = !{i32 2, !"Debug Info Version", i32 3}
|