xref: /llvm-project/llvm/test/CodeGen/AArch64/tail-duplicate-debug-variance.mir (revision f7bee65728becbfbf82ba46fd0726f13f43b0e33)
1# RUN: llc %s -o - -run-pass=early-tailduplication | FileCheck %s --check-prefixes=CHECK,DEBUG
2# RUN: llc %s -o - -run-pass=mir-strip-debug,early-tailduplication -mir-strip-debugify-only=0 | FileCheck %s --check-prefix=CHECK
3
4# We should get the same result with and without debug information.
5# Specifically, the register class of [[COPY]] should not be changed to
6# gpr32common with debug info while staying as gpr32sp without.
7
8--- |
9  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
10  target triple = "aarch64-none-linux-gnu"
11
12  define void @test() !dbg !8 {
13  entry:
14    ret void
15  }
16
17  !llvm.dbg.cu = !{!0}
18  !llvm.module.flags = !{!2, !3, !4, !5}
19  !llvm.ident = !{!6}
20
21  !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "My compiler", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
22  !1 = !DIFile(filename: "foo.c", directory: "/bar")
23  !2 = !{i32 7, !"Dwarf Version", i32 4}
24  !3 = !{i32 2, !"Debug Info Version", i32 3}
25  !4 = !{i32 1, !"wchar_size", i32 1}
26  !5 = !{i32 7, !"frame-pointer", i32 2}
27  !6 = !{!"My compiler"}
28  !7 = !DILocalVariable(name: "i", scope: !8, file: !1, line: 6, type: !12)
29  !8 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 5, type: !9, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
30  !9 = !DISubroutineType(types: !10)
31  !10 = !{null}
32  !11 = !{!7}
33  !12 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
34  !13 = !DILocation(line: 0, scope: !8)
35...
36---
37name:            test
38tracksRegLiveness: true
39liveins:         []
40body:             |
41  ; CHECK-LABEL: name: test
42  ; CHECK: bb.0:
43  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
44  ; CHECK-NEXT:   liveins: $w0, $wzr
45  ; CHECK-NEXT: {{  $}}
46  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:gpr32sp = COPY $w0
47  ; CHECK-NEXT:   CBNZW $wzr, %bb.2
48  ; CHECK-NEXT: {{  $}}
49  ; CHECK-NEXT: bb.1:
50  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
51  ; CHECK-NEXT: {{  $}}
52  ; CHECK-NEXT:   $x0 = COPY undef $x0
53  ; DEBUG-NEXT:   DBG_VALUE [[COPY]], $noreg, !11, !DIExpression(), debug-location !DILocation(line: 0, scope: !7)
54  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:gpr32 = COPY [[COPY]]
55  ; CHECK-NEXT:   B %bb.4
56  ; CHECK-NEXT: {{  $}}
57  ; CHECK-NEXT: bb.2:
58  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
59  ; CHECK-NEXT: {{  $}}
60  ; DEBUG-NEXT:   DBG_VALUE [[COPY]], $noreg, !11, !DIExpression(), debug-location !DILocation(line: 0, scope: !7)
61  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:gpr32 = COPY [[COPY]]
62  ; CHECK-NEXT: {{  $}}
63  ; CHECK-NEXT: bb.4:
64  ; CHECK-NEXT:   RET undef $lr, implicit undef $w0
65  bb.0:
66    successors: %bb.2, %bb.1
67    liveins: $w0, $wzr
68
69    %1:gpr32sp = COPY $w0
70    CBNZW $wzr, %bb.2
71
72  bb.1:
73    successors: %bb.3
74
75    $x0 = COPY undef $x0
76    B %bb.3
77
78  bb.2:
79    successors: %bb.3
80
81  bb.3:
82    successors: %bb.5
83
84    %2:gpr32 = PHI %1, %bb.1, %1, %bb.2
85    DBG_VALUE %2, $noreg, !7, !DIExpression(), debug-location !13
86    B %bb.5
87
88  bb.4:
89    RET undef $lr, implicit undef $w0
90
91  bb.5:
92    successors: %bb.4
93
94    B %bb.4
95...
96