summaryrefslogtreecommitdiff
path: root/test/LTO
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-03-07 02:49:57 +0000
committerAdrian Prantl <aprantl@apple.com>2017-03-07 02:49:57 +0000
commitc577b1403ca962a817a3831af1252a2f9aa34484 (patch)
treee4f02ef29c834399e3730e4655fc477fad3660f2 /test/LTO
parent1f41782fb2b2948bfa9dd0a17b4cab5c812299a7 (diff)
Add a testcase for r297072.
Check that missing debug locations on inlinable calls are a recoverable error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r--test/LTO/X86/strip-debug-info-no-call-loc.ll56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/LTO/X86/strip-debug-info-no-call-loc.ll b/test/LTO/X86/strip-debug-info-no-call-loc.ll
new file mode 100644
index 00000000000..39b8c40c3a4
--- /dev/null
+++ b/test/LTO/X86/strip-debug-info-no-call-loc.ll
@@ -0,0 +1,56 @@
+; RUN: llvm-as %s -disable-verify -o %t.bc
+; RUN: llvm-lto -lto-strip-invalid-debug-info=true \
+; RUN: -exported-symbol f -exported-symbol _f \
+; RUN: -o %t.o %t.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty -check-prefix=CHECK-WARN
+; RUN: llvm-nm %t.o | FileCheck %s
+
+; Check that missing debug locations on inlinable calls are a
+; recoverable error.
+
+; CHECK-WARN: Invalid debug info found, debug info will be stripped
+; CHECK: {{f$}}
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx"
+
+define void @h() #0 !dbg !7 {
+entry:
+ call void (...) @i(), !dbg !9
+ ret void, !dbg !10
+}
+
+declare void @i(...) #1
+
+define void @g() #0 !dbg !11 {
+entry:
+; Manually removed !dbg.
+ call void @h()
+ ret void, !dbg !13
+}
+
+define void @f() #0 !dbg !14 {
+entry:
+ call void @g(), !dbg !15
+ ret void, !dbg !16
+}
+
+attributes #0 = { nounwind ssp uwtable }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: LineTablesOnly, enums: !2)
+!1 = !DIFile(filename: "test.c", directory: "/")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 2}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!7 = distinct !DISubprogram(name: "h", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, variables: !2)
+!8 = !DISubroutineType(types: !2)
+!9 = !DILocation(line: 2, column: 12, scope: !7)
+!10 = !DILocation(line: 2, column: 17, scope: !7)
+!11 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !0, variables: !2)
+!12 = !DILocation(line: 3, column: 12, scope: !11)
+!13 = !DILocation(line: 3, column: 17, scope: !11)
+!14 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !0, variables: !2)
+!15 = !DILocation(line: 4, column: 12, scope: !14)
+!16 = !DILocation(line: 4, column: 17, scope: !14)