summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-06-18 19:42:29 +0000
committerAdrian Prantl <aprantl@apple.com>2019-06-18 19:42:29 +0000
commit8ff822d61dacf5a9466755eedafd3eeb54abc00d (patch)
tree591cea498ecc6495963e01cac06e7473df1e39fd /llvm/test
parenta702f07301feae769e993c125e7d61c36a613730 (diff)
downloadbcm5719-llvm-8ff822d61dacf5a9466755eedafd3eeb54abc00d.tar.gz
bcm5719-llvm-8ff822d61dacf5a9466755eedafd3eeb54abc00d.zip
Add debug location verification for !llvm.loop attachments.
This patch teaches the Verifier how to detect broken !llvm.loop attachments as discussed in https://reviews.llvm.org/D60831. This allows LLVM to warn and strip out the broken debug info before attempting an LTO compilation with input generated by LLVM predating https://reviews.llvm.org/rL361149. rdar://problem/51631158 Differential Revision: https://reviews.llvm.org/D63499 llvm-svn: 363725
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Verifier/llvm.loop.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Verifier/llvm.loop.ll b/llvm/test/Verifier/llvm.loop.ll
new file mode 100644
index 00000000000..3475abb673a
--- /dev/null
+++ b/llvm/test/Verifier/llvm.loop.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
+
+define i32 @foo() !dbg !4 {
+entry:
+ ret i32 0, !dbg !6
+}
+
+define i32 @bar() !dbg !5 {
+entry:
+; CHECK: !dbg attachment points at wrong subprogram for function
+ ret i32 0, !dbg !10, !llvm.loop !9
+}
+
+; CHECK: warning: ignoring invalid debug info
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!7, !8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
+!1 = !DIFile(filename: "dwarf-test.c", directory: "test")
+!2 = !{}
+!4 = distinct !DISubprogram(name: "foo", scope: !0, isDefinition: true, unit: !0)
+!5 = distinct !DISubprogram(name: "bar", scope: !0, isDefinition: true, unit: !0)
+!6 = !DILocation(line: 7, scope: !4)
+!7 = !{i32 2, !"Dwarf Version", i32 3}
+!8 = !{i32 1, !"Debug Info Version", i32 3}
+!9 = !{!9, !10, !11}
+!10 = !DILocation(line: 1, scope: !5)
+!11 = !DILocation(line: 1, scope: !4)
OpenPOWER on IntegriCloud