1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3 2# RUN: llc --aarch64-enable-sink-fold=true --run-pass=machine-sink %s -o - | FileCheck %s 3--- | 4 source_filename = "dbg.c" 5 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 6 target triple = "aarch64-unknown-linux" 7 8 define dso_local void @g(i32 noundef %x) local_unnamed_addr !dbg !11 { 9 entry: 10 call void @llvm.dbg.value(metadata i32 %x, metadata !16, metadata !DIExpression()), !dbg !20 11 %add = add nsw i32 %x, 1, !dbg !21 12 call void @llvm.dbg.value(metadata i32 %add, metadata !17, metadata !DIExpression()), !dbg !20 13 call void @llvm.dbg.value(metadata i32 %add, metadata !18, metadata !DIExpression()), !dbg !20 14 %call = tail call i32 @f(i32 noundef %add), !dbg !22 15 call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !20 16 %call1 = tail call i32 @f(i32 noundef %add), !dbg !23 17 ret void, !dbg !24 18 } 19 20 declare !dbg !25 i32 @f(i32 noundef) 21 22 declare void @llvm.dbg.value(metadata, metadata, metadata) 23 24 !llvm.dbg.cu = !{!0} 25 !llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8, !9} 26 !llvm.ident = !{!10} 27 28 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 29 !1 = !DIFile(filename: "dbg.c", directory: "/home/sweet", checksumkind: CSK_MD5, checksum: "b6bd7ad2140c696af9201a17ab73c918") 30 !2 = !{i32 7, !"Dwarf Version", i32 5} 31 !3 = !{i32 2, !"Debug Info Version", i32 3} 32 !4 = !{i32 1, !"wchar_size", i32 4} 33 !5 = !{i32 8, !"PIC Level", i32 2} 34 !6 = !{i32 7, !"PIE Level", i32 2} 35 !7 = !{i32 7, !"uwtable", i32 2} 36 !8 = !{i32 7, !"frame-pointer", i32 1} 37 !9 = !{i32 7, !"debug-info-assignment-tracking", i1 true} 38 !10 = !{!"clang version 18.0.0"} 39 !11 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 3, type: !12, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15) 40 !12 = !DISubroutineType(types: !13) 41 !13 = !{null, !14} 42 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 43 !15 = !{!16, !17, !18, !19} 44 !16 = !DILocalVariable(name: "x", arg: 1, scope: !11, file: !1, line: 3, type: !14) 45 !17 = !DILocalVariable(name: "y", scope: !11, file: !1, line: 4, type: !14) 46 !18 = !DILocalVariable(name: "t0", scope: !11, file: !1, line: 6, type: !14) 47 !19 = !DILocalVariable(name: "t1", scope: !11, file: !1, line: 9, type: !14) 48 !20 = !DILocation(line: 0, scope: !11) 49 !21 = !DILocation(line: 4, column: 13, scope: !11) 50 !22 = !DILocation(line: 7, column: 3, scope: !11) 51 !23 = !DILocation(line: 10, column: 3, scope: !11) 52 !24 = !DILocation(line: 11, column: 1, scope: !11) 53 !25 = !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !26, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) 54 !26 = !DISubroutineType(types: !27) 55 !27 = !{!14, !14} 56 57... 58--- 59name: g 60alignment: 4 61exposesReturnsTwice: false 62legalized: false 63regBankSelected: false 64selected: false 65failedISel: false 66tracksRegLiveness: true 67hasWinCFI: false 68callsEHReturn: false 69callsUnwindInit: false 70hasEHCatchret: false 71hasEHScopes: false 72hasEHFunclets: false 73isOutlined: false 74debugInstrRef: false 75failsVerification: false 76tracksDebugUserValues: false 77registers: 78 - { id: 0, class: gpr32common, preferred-register: '' } 79 - { id: 1, class: gpr32sp, preferred-register: '' } 80 - { id: 2, class: gpr32all, preferred-register: '' } 81liveins: 82 - { reg: '$w0', virtual-reg: '%0' } 83frameInfo: 84 isFrameAddressTaken: false 85 isReturnAddressTaken: false 86 hasStackMap: false 87 hasPatchPoint: false 88 stackSize: 0 89 offsetAdjustment: 0 90 maxAlignment: 1 91 adjustsStack: true 92 hasCalls: true 93 stackProtector: '' 94 functionContext: '' 95 maxCallFrameSize: 0 96 cvBytesOfCalleeSavedRegisters: 0 97 hasOpaqueSPAdjustment: false 98 hasVAStart: false 99 hasMustTailInVarArgFunc: false 100 hasTailCall: true 101 localFrameSize: 0 102 savePoint: '' 103 restorePoint: '' 104fixedStack: [] 105stack: [] 106entry_values: [] 107callSites: [] 108debugValueSubstitutions: [] 109constants: [] 110machineFunctionInfo: {} 111body: | 112 bb.0.entry: 113 liveins: $w0 114 115 ; CHECK-LABEL: name: g 116 ; CHECK: liveins: $w0 117 ; CHECK-NEXT: {{ $}} 118 ; CHECK-NEXT: DBG_VALUE $w0, $noreg, !16, !DIExpression(), debug-location !20 119 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32common = COPY $w0 120 ; CHECK-NEXT: DBG_VALUE [[COPY]], $noreg, !16, !DIExpression(), debug-location !20 121 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, !17, !DIExpression(), debug-location !20 122 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, !18, !DIExpression(), debug-location !20 123 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp, debug-location !22 124 ; CHECK-NEXT: $w0 = nsw ADDWri [[COPY]], 1, 0, debug-location !21 125 ; CHECK-NEXT: BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w0, debug-location !22 126 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp, debug-location !22 127 ; CHECK-NEXT: DBG_VALUE $noreg, $noreg, !19, !DIExpression(), debug-location !20 128 ; CHECK-NEXT: $w0 = nsw ADDWri [[COPY]], 1, 0, debug-location !21 129 ; CHECK-NEXT: TCRETURNdi @f, 0, csr_aarch64_aapcs, implicit $sp, implicit $w0, debug-location !23 130 DBG_VALUE $w0, $noreg, !16, !DIExpression(), debug-location !20 131 %0:gpr32common = COPY $w0 132 DBG_VALUE %0, $noreg, !16, !DIExpression(), debug-location !20 133 %1:gpr32sp = nsw ADDWri %0, 1, 0, debug-location !21 134 DBG_VALUE %1, $noreg, !17, !DIExpression(), debug-location !20 135 DBG_VALUE %1, $noreg, !18, !DIExpression(), debug-location !20 136 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp, debug-location !22 137 $w0 = COPY %1, debug-location !22 138 BL @f, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w0, debug-location !22 139 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp, debug-location !22 140 DBG_VALUE %1, $noreg, !19, !DIExpression(), debug-location !20 141 $w0 = COPY %1, debug-location !23 142 TCRETURNdi @f, 0, csr_aarch64_aapcs, implicit $sp, implicit $w0, debug-location !23 143 144... 145