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
4 # Difference between test_1 and test_2 is that there is a DBG_VALUE in test_1.
5 # If transformation is debug invariant the resulting LEA instruction should be
6 # the same (i.e. we should reuse the same stack slot).
10 source_filename = "StackColoring-dbg-invariance.ll"
11 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
12 target triple = "x86_64-apple-macosx10.8.0"
14 ; Function Attrs: argmemonly nofree nosync nounwind willreturn
15 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
17 ; Function Attrs: argmemonly nofree nosync nounwind willreturn
18 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
20 define i32 @test_1(i32 %in) #1 !dbg !5 {
22 %a1 = alloca [14 x ptr], align 8
23 %a4 = alloca [11 x ptr], align 8
24 call void @llvm.dbg.value(metadata ptr %a4, metadata !9, metadata !DIExpression()), !dbg !11
28 define i32 @test_2(i32 %in) #1 !dbg !12 {
30 %a1 = alloca [14 x ptr], align 8
31 %a4 = alloca [11 x ptr], align 8
35 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
36 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
38 attributes #0 = { argmemonly nofree nosync nounwind willreturn "target-cpu"="corei7" }
39 attributes #1 = { "target-cpu"="corei7" }
42 !llvm.debugify = !{!2, !3}
43 !llvm.module.flags = !{!4}
45 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
46 !1 = !DIFile(filename: "StackColoring-dbg-invariance.ll", directory: "/")
49 !4 = !{i32 2, !"Debug Info Version", i32 3}
50 !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)
51 !6 = !DISubroutineType(types: !7)
54 !9 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 4, type: !10)
55 !10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
56 !11 = !DILocation(line: 4, column: 1, scope: !5)
57 !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)
63 tracksRegLiveness: true
65 - { id: 0, name: a1, type: default, offset: 0, size: 112, alignment: 8,
66 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
67 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
68 - { id: 3, name: a4, type: default, offset: 0, size: 88, alignment: 8,
69 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
70 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
75 ; CHECK-LABEL: name: test_1
76 ; CHECK: liveins: $edi
77 ; CHECK: DBG_VALUE %stack.0.a1, $noreg, !9, !DIExpression(), debug-location !11
78 ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
79 ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
81 DBG_VALUE %stack.3.a4, $noreg, !9, !DIExpression(), debug-location !11
82 LIFETIME_START %stack.3.a4
83 LIFETIME_START %stack.0.a1
84 %0:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
85 LIFETIME_END %stack.0.a1
86 %1:gr64 = LEA64r %stack.3.a4, 1, $noreg, 0, $noreg
87 LIFETIME_END %stack.3.a4
93 tracksRegLiveness: true
95 - { id: 0, name: a1, type: default, offset: 0, size: 112, alignment: 8,
96 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
97 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
98 - { id: 3, name: a4, type: default, offset: 0, size: 88, alignment: 8,
99 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
100 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
105 ; CHECK-LABEL: name: test_2
106 ; CHECK: liveins: $edi
107 ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
108 ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
110 LIFETIME_START %stack.3.a4
111 LIFETIME_START %stack.0.a1
112 %0:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg
113 LIFETIME_END %stack.0.a1
114 %1:gr64 = LEA64r %stack.3.a4, 1, $noreg, 0, $noreg
115 LIFETIME_END %stack.3.a4