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 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). 7 8--- | 9 ; ModuleID = '<stdin>' 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" 13 14 ; Function Attrs: argmemonly nofree nosync nounwind willreturn 15 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0 16 17 ; Function Attrs: argmemonly nofree nosync nounwind willreturn 18 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0 19 20 define i32 @test_1(i32 %in) #1 !dbg !5 { 21 entry: 22 %a1 = alloca [14 x i8*], align 8 23 %a4 = alloca [11 x i8*], align 8 24 call void @llvm.dbg.value(metadata [11 x i8*]* %a4, metadata !9, metadata !DIExpression()), !dbg !11 25 ret i32 0 26 } 27 28 define i32 @test_2(i32 %in) #1 !dbg !12 { 29 entry: 30 %a1 = alloca [14 x i8*], align 8 31 %a4 = alloca [11 x i8*], align 8 32 ret i32 0 33 } 34 35 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 36 declare void @llvm.dbg.value(metadata, metadata, metadata) #2 37 38 attributes #0 = { argmemonly nofree nosync nounwind willreturn "target-cpu"="corei7" } 39 attributes #1 = { "target-cpu"="corei7" } 40 41 !llvm.dbg.cu = !{!0} 42 !llvm.debugify = !{!2, !3} 43 !llvm.module.flags = !{!4} 44 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: "/") 47 !2 = !{i32 27} 48 !3 = !{i32 18} 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) 52 !7 = !{} 53 !8 = !{!9} 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) 58 59... 60--- 61name: test_1 62alignment: 16 63tracksRegLiveness: true 64stack: 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: '' } 71body: | 72 bb.0.entry: 73 liveins: $edi 74 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 80 ; CHECK: RET 0 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 88 RET 0 89... 90--- 91name: test_2 92alignment: 16 93tracksRegLiveness: true 94stack: 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: '' } 101body: | 102 bb.0.entry: 103 liveins: $edi 104 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 109 ; CHECK: RET 0 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 116 RET 0 117... 118