xref: /llvm-project/llvm/test/DebugInfo/assignment-tracking/X86/coalesce-options.ll (revision d3a6a90ae5e80b074293ebfbcb2f15da9c57acc5)
1;; Test coalescing of contiguous fragments in adjacent location definitions.
2;; This test contains the first function from coalesce-simple.ll. Just use it
3;; to check whether coalescing happens or not with different flag settings.
4;;
5;; +=================+==============================+======================+
6;; | Coalescing flag | Instruction-Referencing flag | Coalescing behaviour |
7;; +=================+==============================+======================+
8;; | default         | enabled                      | enabled              |
9;; | default         | disabled                     | disabled             |
10;; | enabled         | *                            | enabled              |
11;; | disabled        | *                            | disabled             |
12;; +-----------------+------------------------------+----------------------+
13
14;; Coalescing default + instructino-referencing enabled = enable.
15; RUN: llc %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=true \
16; RUN: | FileCheck %s --check-prefixes=CHECK,ENABLE
17; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=true \
18; RUN: | FileCheck %s --check-prefixes=CHECK,ENABLE
19
20;; Coalescing default + instructino-referencing disabled = disable.
21; RUN: llc %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=false \
22; RUN: | FileCheck %s --check-prefixes=CHECK,DISABLE
23; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=false \
24; RUN: | FileCheck %s --check-prefixes=CHECK,DISABLE
25
26;; Coalescing enabled + instructino-referencing disabled = enable.
27; RUN: llc %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=false \
28; RUN:     -debug-ata-coalesce-frags=true \
29; RUN: | FileCheck %s --check-prefixes=CHECK,ENABLE
30; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=false \
31; RUN:     -debug-ata-coalesce-frags=true \
32; RUN: | FileCheck %s --check-prefixes=CHECK,ENABLE
33
34;; Coalescing disabled + instructino-referencing enabled = disable.
35; RUN: llc %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=true \
36; RUN:     -debug-ata-coalesce-frags=false \
37; RUN: | FileCheck %s --check-prefixes=CHECK,DISABLE
38; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel -experimental-debug-variable-locations=true \
39; RUN:     -debug-ata-coalesce-frags=false \
40; RUN: | FileCheck %s --check-prefixes=CHECK,DISABLE
41
42; CHECK: MOV32mi %stack.0.a, 1, $noreg, 0, $noreg, 5
43; ENABLE-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref)
44; DISABLE-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 32)
45
46target triple = "x86_64-unknown-linux-gnu"
47
48define dso_local void @_Z3funv() local_unnamed_addr !dbg !16 {
49entry:
50  %a = alloca i64, !DIAssignID !37
51  call void @llvm.dbg.assign(metadata i64 poison, metadata !20, metadata !DIExpression(), metadata !37, metadata ptr %a, metadata !DIExpression()), !dbg !25
52  call void @llvm.dbg.value(metadata i32 1, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !25
53  store i32 5, ptr %a, !DIAssignID !38
54  call void @llvm.dbg.assign(metadata i32 5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !38, metadata ptr %a, metadata !DIExpression()), !dbg !25
55  ret void
56}
57
58declare void @llvm.dbg.value(metadata, metadata, metadata)
59declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
60
61!llvm.dbg.cu = !{!2}
62!llvm.module.flags = !{!8, !9, !10, !11, !12, !13, !14}
63!llvm.ident = !{!15}
64
65!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
66!1 = distinct !DIGlobalVariable(name: "G", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
67!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
68!3 = !DIFile(filename: "test.cpp", directory: "/")
69!4 = !{!0, !5}
70!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
71!6 = distinct !DIGlobalVariable(name: "F", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
72!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
73!8 = !{i32 7, !"Dwarf Version", i32 5}
74!9 = !{i32 2, !"Debug Info Version", i32 3}
75!10 = !{i32 1, !"wchar_size", i32 4}
76!11 = !{i32 8, !"PIC Level", i32 2}
77!12 = !{i32 7, !"PIE Level", i32 2}
78!13 = !{i32 7, !"uwtable", i32 2}
79!14 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
80!15 = !{!"clang version 17.0.0"}
81!16 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 3, type: !17, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !19)
82!17 = !DISubroutineType(types: !18)
83!18 = !{null}
84!19 = !{!20}
85!20 = !DILocalVariable(name: "X", scope: !16, file: !3, line: 4, type: !21)
86!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Pair", file: !3, line: 2, size: 64, flags: DIFlagTypePassByValue, elements: !22, identifier: "_ZTS4Pair")
87!22 = !{}
88!25 = !DILocation(line: 0, scope: !16)
89!26 = !DILocation(line: 7, column: 7, scope: !27)
90!27 = distinct !DILexicalBlock(scope: !16, file: !3, line: 7, column: 7)
91!37 = distinct !DIAssignID()
92!38 = distinct !DIAssignID()
93