[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / test / CodeGen / X86 / StackColoring-dbg-invariance.mir
blob348a2901ff6a46fd2c38b0e00c5b9e3a0eccd7de
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mcpu=corei7 -no-stack-coloring=false -run-pass=stack-coloring -o - %s | FileCheck %s
3 # RUN: llc -mcpu=corei7 -no-stack-coloring=false -passes=stack-coloring -o - %s | FileCheck %s
5 # Difference between test_1 and test_2 is that there is a DBG_VALUE in test_1.
6 # If transformation is debug invariant the resulting LEA instruction should be
7 # the same (i.e. we should reuse the same stack slot).
9 --- |
10   ; ModuleID = '<stdin>'
11   source_filename = "StackColoring-dbg-invariance.ll"
12   target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
13   target triple = "x86_64-apple-macosx10.8.0"
15   ; Function Attrs: argmemonly nofree nosync nounwind willreturn
16   declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
18   ; Function Attrs: argmemonly nofree nosync nounwind willreturn
19   declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
21   define i32 @test_1(i32 %in) #1 !dbg !5 {
22   entry:
23     %a1 = alloca [14 x ptr], align 8
24     %a4 = alloca [11 x ptr], align 8
25     call void @llvm.dbg.value(metadata ptr %a4, metadata !9, metadata !DIExpression()), !dbg !11
26     ret i32 0
27   }
29   define i32 @test_2(i32 %in) #1 !dbg !12 {
30   entry:
31     %a1 = alloca [14 x ptr], align 8
32     %a4 = alloca [11 x ptr], align 8
33     ret i32 0
34   }
36   ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
37   declare void @llvm.dbg.value(metadata, metadata, metadata) #2
39   attributes #0 = { argmemonly nofree nosync nounwind willreturn "target-cpu"="corei7" }
40   attributes #1 = { "target-cpu"="corei7" }
42   !llvm.dbg.cu = !{!0}
43   !llvm.debugify = !{!2, !3}
44   !llvm.module.flags = !{!4}
46   !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
47   !1 = !DIFile(filename: "StackColoring-dbg-invariance.ll", directory: "/")
48   !2 = !{i32 27}
49   !3 = !{i32 18}
50   !4 = !{i32 2, !"Debug Info Version", i32 3}
51   !5 = distinct !DISubprogram(name: "test_1", linkageName: "test_1", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
52   !6 = !DISubroutineType(types: !7)
53   !7 = !{}
54   !8 = !{!9}
55   !9 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 4, type: !10)
56   !10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
57   !11 = !DILocation(line: 4, column: 1, scope: !5)
58   !12 = distinct !DISubprogram(name: "test_2", linkageName: "test_2", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
60 ...
61 ---
62 name:            test_1
63 alignment:       16
64 tracksRegLiveness: true
65 stack:
66   - { id: 0, name: a1, type: default, offset: 0, size: 112, alignment: 8,
67       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
68       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
69   - { id: 3, name: a4, type: default, offset: 0, size: 88, alignment: 8,
70       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
71       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
72 body:             |
73   bb.0.entry:
74     liveins: $edi
76     ; CHECK-LABEL: name: test_1
77     ; CHECK: liveins: $edi
78     ; CHECK: DBG_VALUE %stack.0.a1, $noreg, !9, !DIExpression(), debug-location !11
79     ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
80     ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
81     ; CHECK: RET 0
82     DBG_VALUE %stack.3.a4, $noreg, !9, !DIExpression(), debug-location !11
83     LIFETIME_START %stack.3.a4
84     LIFETIME_START %stack.0.a1
85     %0:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
86     LIFETIME_END %stack.0.a1
87     %1:gr64 = LEA64r %stack.3.a4, 1, $noreg, 0, $noreg
88     LIFETIME_END %stack.3.a4
89     RET 0
90 ...
91 ---
92 name:            test_2
93 alignment:       16
94 tracksRegLiveness: true
95 stack:
96   - { id: 0, name: a1, type: default, offset: 0, size: 112, alignment: 8,
97       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
98       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
99   - { id: 3, name: a4, type: default, offset: 0, size: 88, alignment: 8,
100       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
101       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
102 body:             |
103   bb.0.entry:
104     liveins: $edi
106     ; CHECK-LABEL: name: test_2
107     ; CHECK: liveins: $edi
108     ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
109     ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
110     ; CHECK: RET 0
111     LIFETIME_START %stack.3.a4
112     LIFETIME_START %stack.0.a1
113     %0:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
114     LIFETIME_END %stack.0.a1
115     %1:gr64 = LEA64r %stack.3.a4, 1, $noreg, 0, $noreg
116     LIFETIME_END %stack.3.a4
117     RET 0