xref: /llvm-project/llvm/test/LTO/X86/pr38046.ll (revision a19629dae70c9f7e7936eba7aa1e0a3a99742288)
1; RUN: opt -module-summary -o %t.o %s
2; RUN: llvm-lto2 run -save-temps -o %t.lto.o %t.o \
3; RUN:   -r=%t.o,foo,plx \
4; RUN:   -r=%t.o,get,pl
5; RUN: llvm-dis %t.lto.o.0.2.internalize.bc >/dev/null 2>%t.dis.stderr || true
6; RUN: FileCheck -allow-empty %s < %t.dis.stderr
7
8;; Re-run with "new" debug-info mode to ensure the variable location information
9;; is handled gracefully.
10; RUN: llvm-lto2 run -save-temps -o %t.lto.o %t.o \
11; RUN:   -r=%t.o,foo,plx \
12; RUN:   -r=%t.o,get,pl --try-experimental-debuginfo-iterators
13; RUN: llvm-dis %t.lto.o.0.2.internalize.bc >/dev/null 2>%t.dis.stderr || true
14; RUN: FileCheck -allow-empty %s < %t.dis.stderr
15
16; CHECK-NOT: Global is external, but doesn't have external or weak linkage
17
18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-unknown-linux-gnu"
20
21define i32 @foo() {
22  call void @llvm.dbg.value(metadata ptr @get, metadata !7, metadata !DIExpression()), !dbg !DILocation(scope: !6)
23  ret i32 0
24}
25
26define i32 @get() {
27  ret i32 0
28}
29
30declare void @llvm.dbg.value(metadata, metadata, metadata)
31
32!llvm.dbg.cu = !{!0}
33!llvm.module.flags = !{!2, !3, !4, !5}
34
35!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
36!1 = !DIFile(filename: "t.cc", directory: "/tmp/t")
37!2 = !{i32 2, !"Dwarf Version", i32 4}
38!3 = !{i32 2, !"Debug Info Version", i32 3}
39!4 = !{i32 1, !"wchar_size", i32 4}
40!5 = !{i32 1, !"ThinLTO", i32 0}
41!6 = distinct !DISubprogram(unit: !0)
42!7 = !DILocalVariable(name: "get", scope: !6)
43