summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-03-28 21:06:26 +0000
committerAdrian Prantl <aprantl@apple.com>2016-03-28 21:06:26 +0000
commitfaebbb053d4971a68d10df9a4f3d5db5aeed0afd (patch)
tree77cb00300206f881742871634dfc12bf33f5146c /llvm/test
parent64fa75391cba60721f7b4d07e6fe6126b76809a5 (diff)
downloadbcm5719-llvm-faebbb053d4971a68d10df9a4f3d5db5aeed0afd.tar.gz
bcm5719-llvm-faebbb053d4971a68d10df9a4f3d5db5aeed0afd.zip
Add an IR Verifier check for orphaned DICompileUnits.
A DICompileUnit that is not listed in llvm.dbg.cu will cause assertion failures and/or crashes in the backend. The Verifier should reject this. rdar://problem/25369499 llvm-svn: 264657
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Assembler/dicompileunit.ll5
-rw-r--r--llvm/test/Transforms/LoopIdiom/debug-line.ll4
-rw-r--r--llvm/test/Verifier/dbg-orphaned-compileunit.ll10
3 files changed, 17 insertions, 2 deletions
diff --git a/llvm/test/Assembler/dicompileunit.ll b/llvm/test/Assembler/dicompileunit.ll
index 92fa61fe6b9..5826448e06f 100644
--- a/llvm/test/Assembler/dicompileunit.ll
+++ b/llvm/test/Assembler/dicompileunit.ll
@@ -1,8 +1,11 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s
+; Force a specific numbering.
; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
+; CHECK: !llvm.dbg.cu = !{!8, !9}
+!llvm.dbg.cu = !{!8, !9}
!0 = distinct !{}
!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
@@ -24,3 +27,5 @@
!9 = distinct !DICompileUnit(language: 12, file: !1, producer: "",
isOptimized: false, flags: "", runtimeVersion: 0,
splitDebugFilename: "", emissionKind: 0)
+!llvm.module.flags = !{!10}
+!10 = !{i32 2, !"Debug Info Version", i32 3}
diff --git a/llvm/test/Transforms/LoopIdiom/debug-line.ll b/llvm/test/Transforms/LoopIdiom/debug-line.ll
index a85e4899754..14f458de8c8 100644
--- a/llvm/test/Transforms/LoopIdiom/debug-line.ll
+++ b/llvm/test/Transforms/LoopIdiom/debug-line.ll
@@ -28,11 +28,11 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
!llvm.module.flags = !{!19}
-!llvm.dbg.sp = !{!0}
+!llvm.dbg.cu = !{!2}
!0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !18, scope: !1, type: !3)
!1 = !DIFile(filename: "li.c", directory: "/private/tmp")
-!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, emissionKind: 0, file: !18, enums: !9, retainedTypes: !9)
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, emissionKind: 0, file: !18, enums: !9, subprograms: !{!0}, retainedTypes: !9)
!3 = !DISubroutineType(types: !4)
!4 = !{null}
!5 = !DILocalVariable(name: "a", line: 2, arg: 1, scope: !0, file: !1, type: !6)
diff --git a/llvm/test/Verifier/dbg-orphaned-compileunit.ll b/llvm/test/Verifier/dbg-orphaned-compileunit.ll
new file mode 100644
index 00000000000..0be14a2fa66
--- /dev/null
+++ b/llvm/test/Verifier/dbg-orphaned-compileunit.ll
@@ -0,0 +1,10 @@
+; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: assembly parsed, but does not verify
+; CHECK-NEXT: All DICompileUnits must be listed in llvm.dbg.cu
+
+!named = !{!1}
+!llvm.module.flags = !{!0}
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!llvm.dbg.cu = !{}
+!1 = distinct !DICompileUnit(file: !2, language: DW_LANG_Fortran77)
+!2 = !DIFile(filename: "test.f", directory: "")
OpenPOWER on IntegriCloud