xref: /llvm-project/llvm/test/DebugInfo/assignment-tracking/X86/split-alloca.ll (revision 30845e8ab46c416a2e333eb84239e9ec71e92617)
1; RUN: llc %s -o - -stop-after=finalize-isel \
2; RUN: | FileCheck %s --implicit-check-not=DBG
3
4
5; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel \
6; RUN: | FileCheck %s --implicit-check-not=DBG
7
8;; Hand written. Check that we fall back to emitting a list of defs for
9;; variables with split allocas (i.e. we want to see DBG_VALUEs and no
10;; debug-info-variable entry in the stack slot table).
11
12; CHECK: stack:
13; CHECK:   - { id: 0, name: a, type: default, offset: 0, size: 4, alignment: 4,
14; CHECK:       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
15; CHECK:       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
16; CHECK:   - { id: 1, name: c, type: default, offset: 0, size: 4, alignment: 4,
17; CHECK:       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
18; CHECK:       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
19; CHECK: DBG_VALUE %stack.0.a, $noreg, !{{.*}}, !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 32)
20; CHECK: DBG_VALUE %stack.1.c, $noreg, !{{.*}}, !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 64, 32)
21
22target triple = "x86_64-unknown-linux-gnu"
23
24define dso_local void @fun() !dbg !7 {
25entry:
26  %a = alloca i32, align 4, !DIAssignID !16
27  call void @llvm.dbg.assign(metadata i1 undef, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !16, metadata ptr %a, metadata !DIExpression()), !dbg !17
28  %c = alloca i32, align 4, !DIAssignID !20
29  call void @llvm.dbg.assign(metadata i1 undef, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32), metadata !20, metadata ptr %c, metadata !DIExpression()), !dbg !17
30  store i32 5, ptr %a, !DIAssignID !21
31  ret void, !dbg !19
32}
33
34declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
35
36!llvm.dbg.cu = !{!0}
37!llvm.module.flags = !{!2, !3, !4, !5, !1000}
38!llvm.ident = !{!6}
39
40!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
41!1 = !DIFile(filename: "test.c", directory: "/")
42!2 = !{i32 7, !"Dwarf Version", i32 5}
43!3 = !{i32 2, !"Debug Info Version", i32 3}
44!4 = !{i32 1, !"wchar_size", i32 4}
45!5 = !{i32 7, !"uwtable", i32 1}
46!6 = !{!"clang version 14.0.0"}
47!7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
48!8 = !DISubroutineType(types: !9)
49!9 = !{null}
50!10 = !{!11}
51!11 = !DILocalVariable(name: "local", scope: !7, file: !1, line: 2, type: !12)
52!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 96, elements: !14)
53!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
54!14 = !{!15}
55!15 = !DISubrange(count: 3)
56!16 = distinct !DIAssignID()
57!17 = !DILocation(line: 0, scope: !7)
58!18 = !DILocation(line: 2, column: 3, scope: !7)
59!19 = !DILocation(line: 3, column: 1, scope: !7)
60!20 = distinct !DIAssignID()
61!21 = distinct !DIAssignID()
62!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
63