1# Check that the codegenprepare succeeds in dupRetToEnableTailCallOpts() also 2# in the presence of a call to @llvm.dbg.value() 3# 4# RUN: llc %s -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=codegenprepare \ 5# RUN: -stop-after codegenprepare -o - | FileCheck %s 6# 7# CHECK-LABEL: bb1: 8# CHECK: ret 9# CHECK-LABEL: bb2: 10# CHECK: ret 11 12 13# Generated with: 14# 15# bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 -stop-before codegenprepare -simplify-mir 16# 17# %0 = type { i32 (...)**, i16, %1* } 18# %1 = type { i32 (...)** } 19# %2 = type { i32 (...)**, %1*, i8, i32, i32, i32, i16, i32, i16, i32, i16*, %3*, %6*, %9 } 20# %3 = type { %4 } 21# %4 = type { i32 (...)**, i8, i32, i32, %5**, %1* } 22# %5 = type { i32, i32 } 23# %6 = type { %7*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %1* } 24# %7 = type { %8 } 25# %8 = type { i32 (...)**, i8, i32, i32, %0**, %1* } 26# %9 = type { i8* } 27# %10 = type { %0, i32, i32, %0* } 28# 29# define %0* @Fun(%2* %arg) !dbg !7 { 30# bb: 31# switch i32 undef, label %bb3 [ 32# i32 58, label %bb1 33# i32 41, label %bb2 34# ], !dbg !14 35# 36# bb1: ; preds = %bb 37# br label %bb4, !dbg !15 38# 39# bb2: ; preds = %bb 40# %tmp = tail call %10* @hoge(%6* undef, %0* undef, i32 signext 0, i32 signext 0), !dbg !16 41# call void @llvm.dbg.value(metadata %10* %tmp, metadata !10, metadata !DIExpression()), !dbg !16 42# br label %bb4, !dbg !17 43# 44# bb3: ; preds = %bb 45# unreachable, !dbg !18 46# 47# bb4: ; preds = %bb2, %bb1 48# %tmp5 = phi %10* [ undef, %bb1 ], [ %tmp, %bb2 ], !dbg !19 49# call void @llvm.dbg.value(metadata %10* %tmp5, metadata !12, metadata !DIExpression()), !dbg !19 50# %tmp6 = bitcast %10* %tmp5 to %0*, !dbg !20 51# call void @llvm.dbg.value(metadata %0* %tmp6, metadata !13, metadata !DIExpression()), !dbg !20 52# ret %0* %tmp6, !dbg !21 53# } 54# 55# declare %10* @hoge(%6*, %0*, i32, i32) 56# 57# ; Function Attrs: nounwind readnone speculatable 58# declare void @llvm.dbg.value(metadata, metadata, metadata) #1 59# 60# attributes #0 = { "use-soft-float"="false" } 61# attributes #1 = { nounwind readnone speculatable } 62# 63# !llvm.module.flags = !{!0, !1} 64# !llvm.dbg.cu = !{!2} 65# !llvm.debugify = !{!5, !6} 66# 67# !0 = !{i32 2, !"Debug Info Version", i32 3} 68# !1 = !{i32 1, !"wchar_size", i32 4} 69# !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4) 70# !3 = !DIFile(filename: "tc.ll", directory: "/") 71# !4 = !{} 72# !5 = !{i32 8} 73# !6 = !{i32 3} 74# !7 = distinct !DISubprogram(name: "eggs", linkageName: "eggs", scope: null, file: !3, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !9) 75# !8 = !DISubroutineType(types: !4) 76# !9 = !{!10, !12, !13} 77# !10 = !DILocalVariable(name: "1", scope: !7, file: !3, line: 3, type: !11) 78# !11 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned) 79# !12 = !DILocalVariable(name: "2", scope: !7, file: !3, line: 6, type: !11) 80# !13 = !DILocalVariable(name: "3", scope: !7, file: !3, line: 7, type: !11) 81# !14 = !DILocation(line: 1, column: 1, scope: !7) 82# !15 = !DILocation(line: 2, column: 1, scope: !7) 83# !16 = !DILocation(line: 3, column: 1, scope: !7) 84# !17 = !DILocation(line: 4, column: 1, scope: !7) 85# !18 = !DILocation(line: 5, column: 1, scope: !7) 86# !19 = !DILocation(line: 6, column: 1, scope: !7) 87# !20 = !DILocation(line: 7, column: 1, scope: !7) 88# !21 = !DILocation(line: 8, column: 1, scope: !7) 89 90 91--- | 92 93 %0 = type { ptr, i16, ptr } 94 %1 = type { ptr } 95 %2 = type { ptr, ptr, i8, i32, i32, i32, i16, i32, i16, i32, ptr, ptr, ptr, %9 } 96 %3 = type { %4 } 97 %4 = type { ptr, i8, i32, i32, ptr, ptr } 98 %5 = type { i32, i32 } 99 %6 = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } 100 %7 = type { %8 } 101 %8 = type { ptr, i8, i32, i32, ptr, ptr } 102 %9 = type { ptr } 103 %10 = type { %0, i32, i32, ptr } 104 105 define ptr @Fun(ptr %arg) #0 !dbg !7 { 106 bb: 107 switch i32 undef, label %bb3 [ 108 i32 58, label %bb1 109 i32 41, label %bb2 110 ], !dbg !14 111 112 bb1: ; preds = %bb 113 br label %bb4, !dbg !15 114 115 bb2: ; preds = %bb 116 %tmp = tail call ptr @hoge(ptr undef, ptr undef, i32 signext 0, i32 signext 0), !dbg !16 117 call void @llvm.dbg.value(metadata ptr %tmp, metadata !10, metadata !DIExpression()), !dbg !16 118 br label %bb4, !dbg !17 119 120 bb3: ; preds = %bb 121 unreachable, !dbg !18 122 123 bb4: ; preds = %bb2, %bb1 124 %tmp5 = phi ptr [ undef, %bb1 ], [ %tmp, %bb2 ], !dbg !19 125 call void @llvm.dbg.value(metadata ptr %tmp5, metadata !12, metadata !DIExpression()), !dbg !19 126 %tmp6 = bitcast ptr %tmp5 to ptr, !dbg !20 127 call void @llvm.dbg.value(metadata ptr %tmp6, metadata !13, metadata !DIExpression()), !dbg !20 128 ret ptr %tmp6, !dbg !21 129 } 130 131 declare ptr @hoge(ptr, ptr, i32, i32) #0 132 133 ; Function Attrs: nounwind readnone speculatable 134 declare void @llvm.dbg.value(metadata, metadata, metadata) #1 135 136 attributes #0 = { "target-cpu"="z13" } 137 attributes #1 = { nounwind readnone speculatable "target-cpu"="z13" } 138 139 !llvm.module.flags = !{!0, !1} 140 !llvm.dbg.cu = !{!2} 141 !llvm.debugify = !{!5, !6} 142 143 !0 = !{i32 2, !"Debug Info Version", i32 3} 144 !1 = !{i32 1, !"wchar_size", i32 4} 145 !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4) 146 !3 = !DIFile(filename: "tc.ll", directory: "/") 147 !4 = !{} 148 !5 = !{i32 8} 149 !6 = !{i32 3} 150 !7 = distinct !DISubprogram(name: "eggs", linkageName: "eggs", scope: null, file: !3, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !9) 151 !8 = !DISubroutineType(types: !4) 152 !9 = !{!10, !12, !13} 153 !10 = !DILocalVariable(name: "1", scope: !7, file: !3, line: 3, type: !11) 154 !11 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned) 155 !12 = !DILocalVariable(name: "2", scope: !7, file: !3, line: 6, type: !11) 156 !13 = !DILocalVariable(name: "3", scope: !7, file: !3, line: 7, type: !11) 157 !14 = !DILocation(line: 1, column: 1, scope: !7) 158 !15 = !DILocation(line: 2, column: 1, scope: !7) 159 !16 = !DILocation(line: 3, column: 1, scope: !7) 160 !17 = !DILocation(line: 4, column: 1, scope: !7) 161 !18 = !DILocation(line: 5, column: 1, scope: !7) 162 !19 = !DILocation(line: 6, column: 1, scope: !7) 163 !20 = !DILocation(line: 7, column: 1, scope: !7) 164 !21 = !DILocation(line: 8, column: 1, scope: !7) 165 166... 167--- 168name: Fun 169alignment: 16 170tracksRegLiveness: true 171... 172