xref: /llvm-project/llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll (revision d109f94f29e2bc2fc31c8870b1e41759f524fe77)
1; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,DAG %s
2; RUN: llc %s -fast-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,FAST %s
3; RUN: llc %s -global-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,GLOBAL %s
4
5;; Run with experimental debuginfo iterators.
6; RUN: llc --try-experimental-debuginfo-iterators %s -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,DAG %s
7; RUN: llc --try-experimental-debuginfo-iterators %s -fast-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,FAST %s
8; RUN: llc --try-experimental-debuginfo-iterators %s -global-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,GLOBAL %s
9
10;; Run with assignment tracking enabled (use sed to add the module flag).
11; RUN: sed 's/;Uncomment-with-sed//g' < %s \
12; RUN: | llc -global-isel=false -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - \
13; RUN: | FileCheck --check-prefixes=CHECK,DAG %s
14
15;; Test that a dbg.value that uses a DIArgList is correctly converted to a
16;; DBG_VALUE_LIST that uses the registers corresponding to its operands.
17
18; CHECK-DAG: [[A_VAR:![0-9]+]] = !DILocalVariable(name: "a"
19; CHECK-DAG: [[B_VAR:![0-9]+]] = !DILocalVariable(name: "b"
20; CHECK-DAG: [[C_VAR:![0-9]+]] = !DILocalVariable(name: "c"
21; CHECK-DAG: [[D_VAR:![0-9]+]] = !DILocalVariable(name: "d"
22; CHECK-LABEL: bb.{{(0|1)}}.entry
23; DAG-DAG: DBG_VALUE_LIST [[A_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), %0, debug-location
24; DAG-DAG: DBG_VALUE_LIST [[B_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), %1, debug-location
25; DAG: DBG_VALUE_LIST [[C_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %0, %1, debug-location
26; DAG: DBG_VALUE_LIST [[D_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_eq, DW_OP_LLVM_arg, 0, DW_OP_ne, DW_OP_LLVM_arg, 1, DW_OP_gt, DW_OP_LLVM_arg, 0, DW_OP_lt, DW_OP_LLVM_arg, 1, DW_OP_le), %0, %1, debug-location
27; FAST-DAG: DBG_VALUE $noreg, $noreg, [[A_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), debug-location
28; FAST-DAG: DBG_VALUE $noreg, $noreg, [[B_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), debug-location
29; FAST: DBG_VALUE $noreg, $noreg, [[C_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), debug-location
30; FAST: DBG_VALUE $noreg, $noreg, [[D_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_eq, DW_OP_LLVM_arg, 0, DW_OP_ne, DW_OP_LLVM_arg, 1, DW_OP_gt, DW_OP_LLVM_arg, 0, DW_OP_lt, DW_OP_LLVM_arg, 1, DW_OP_le), debug-location
31; GLOBAL-DAG: DBG_VALUE $noreg, 0, [[A_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), debug-location
32; GLOBAL-DAG: DBG_VALUE $noreg, 0, [[B_VAR]], !DIExpression(DW_OP_LLVM_arg, 0), debug-location
33; GLOBAL: DBG_VALUE $noreg, 0, [[C_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), debug-location
34; GLOBAL: DBG_VALUE $noreg, 0, [[D_VAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_eq, DW_OP_LLVM_arg, 0, DW_OP_ne, DW_OP_LLVM_arg, 1, DW_OP_gt, DW_OP_LLVM_arg, 0, DW_OP_lt, DW_OP_LLVM_arg, 1, DW_OP_le), debug-location
35
36target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37target triple = "x86_64-pc-windows-msvc19.16.27034"
38
39define dso_local i32 @"?foo@@YAHHH@Z"(i32 %a, i32 %b) local_unnamed_addr !dbg !8 {
40entry:
41  call void @llvm.dbg.value(metadata !DIArgList(i32 %b), metadata !14, metadata !DIExpression(DW_OP_LLVM_arg, 0)), !dbg !17
42  call void @llvm.dbg.value(metadata !DIArgList(i32 %a), metadata !15, metadata !DIExpression(DW_OP_LLVM_arg, 0)), !dbg !17
43  call void @llvm.dbg.value(metadata !DIArgList(i32 %a, i32 %b), metadata !16, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus)), !dbg !17
44  call void @llvm.dbg.value(metadata !DIArgList(i32 %a, i32 %b), metadata !20, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_eq, DW_OP_LLVM_arg, 0, DW_OP_ne, DW_OP_LLVM_arg, 1, DW_OP_gt, DW_OP_LLVM_arg, 0, DW_OP_lt, DW_OP_LLVM_arg, 1, DW_OP_le)), !dbg !17
45  %mul = mul nsw i32 %b, %a, !dbg !18
46  ret i32 %mul, !dbg !18
47}
48
49declare void @llvm.dbg.value(metadata, metadata, metadata)
50
51!llvm.dbg.cu = !{!0}
52!llvm.module.flags = !{!3, !4, !5,
53;Uncomment-with-sed !19,
54!6}
55!llvm.ident = !{!7}
56
57!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
58!1 = !DIFile(filename: "debug_value_list_selectiondag.cpp", directory: "/")
59!2 = !{}
60!3 = !{i32 2, !"CodeView", i32 1}
61!4 = !{i32 2, !"Debug Info Version", i32 3}
62!5 = !{i32 1, !"wchar_size", i32 2}
63!6 = !{i32 7, !"PIC Level", i32 2}
64!7 = !{!"clang version 11.0.0"}
65!8 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAHHH@Z", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
66!9 = !DIFile(filename: ".\\debug_value_list.cpp", directory: "/tmp")
67!10 = !DISubroutineType(types: !11)
68!11 = !{!12, !12, !12}
69!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
70!13 = !{!14, !15, !16}
71!14 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !9, line: 1, type: !12)
72!15 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !9, line: 1, type: !12)
73!16 = !DILocalVariable(name: "c", scope: !8, file: !9, line: 2, type: !12)
74!17 = !DILocation(line: 0, scope: !8)
75!18 = !DILocation(line: 3, scope: !8)
76!19 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
77!20 = !DILocalVariable(name: "d", scope: !8, file: !9, line: 2, type: !12)
78