xref: /llvm-project/llvm/test/DebugInfo/assignment-tracking/X86/global-storage.ll (revision 30845e8ab46c416a2e333eb84239e9ec71e92617)
1; RUN: llc %s -stop-after=finalize-isel -o - | FileCheck %s
2
3
4; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - | FileCheck %s
5
6;; Local variable has global storage. Check AssignmentTrackingAnalysis doesn't
7;; crash/assert.
8
9;; FIXME: We ideally want a DBG_VALUE deref here. It's not possible with the
10;; current setup, but will be possible when assignment tracking is extended to
11;; understand non-alloca storage.
12
13; CHECK: stack: []
14; CHECK-NOT: DBG_
15
16target triple = "x86_64-unknown-linux-gnu"
17
18@a = dso_local global i32 0, align 4
19
20define dso_local void @_Z3funi(i32 noundef %x) !dbg !15 {
21entry:
22  store i32 %x, ptr @a, align 4, !DIAssignID !27
23  call void @llvm.dbg.assign(metadata i32 %x, metadata !23, metadata !DIExpression(), metadata !27, metadata ptr @a, metadata !DIExpression()), !dbg !21
24  ret void
25}
26
27declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
28
29!llvm.dbg.cu = !{!2}
30!llvm.module.flags = !{!6, !7, !13}
31!llvm.ident = !{!14}
32
33!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
34!3 = !DIFile(filename: "test.cpp", directory: "/")
35!4 = !{}
36!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
37!6 = !{i32 7, !"Dwarf Version", i32 5}
38!7 = !{i32 2, !"Debug Info Version", i32 3}
39!13 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
40!14 = !{!"clang version 17.0.0"}
41!15 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funi", scope: !3, file: !3, line: 2, type: !16, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
42!16 = !DISubroutineType(types: !17)
43!17 = !{null, !5}
44!18 = !{}
45!20 = !DILocalVariable(name: "x", arg: 1, scope: !15, file: !3, line: 2, type: !5)
46!21 = !DILocation(line: 0, scope: !15)
47!23 = !DILocalVariable(name: "a", scope: !15, file: !3, line: 3, type: !5)
48!27 = distinct !DIAssignID()
49