1 # Check that the codegenprepare succeeds in dupRetToEnableTailCallOpts() also
2 # in the presence of a call to @llvm.dbg.value()
4 # RUN: llc %s -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=codegenprepare \
5 # RUN: -stop-after codegenprepare -o - | FileCheck %s
15 # bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 -stop-before codegenprepare -simplify-mir
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 }
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* }
25 # %8 = type { i32 (...)**, i8, i32, i32, %0**, %1* }
27 # %10 = type { %0, i32, i32, %0* }
29 # define %0* @Fun(%2* %arg) !dbg !7 {
31 # switch i32 undef, label %bb3 [
37 # br label %bb4, !dbg !15
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
45 # unreachable, !dbg !18
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
55 # declare %10* @hoge(%6*, %0*, i32, i32)
57 # ; Function Attrs: nounwind readnone speculatable
58 # declare void @llvm.dbg.value(metadata, metadata, metadata) #1
60 # attributes #0 = { "use-soft-float"="false" }
61 # attributes #1 = { nounwind readnone speculatable }
63 # !llvm.module.flags = !{!0, !1}
64 # !llvm.dbg.cu = !{!2}
65 # !llvm.debugify = !{!5, !6}
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: "/")
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)
93 %0 = type { i32 (...)**, i16, %1* }
94 %1 = type { i32 (...)** }
95 %2 = type { i32 (...)**, %1*, i8, i32, i32, i32, i16, i32, i16, i32, i16*, %3*, %6*, %9 }
97 %4 = type { i32 (...)**, i8, i32, i32, %5**, %1* }
98 %5 = type { i32, i32 }
99 %6 = type { %7*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %1* }
101 %8 = type { i32 (...)**, i8, i32, i32, %0**, %1* }
103 %10 = type { %0, i32, i32, %0* }
105 define %0* @Fun(%2* %arg) #0 !dbg !7 {
107 switch i32 undef, label %bb3 [
113 br label %bb4, !dbg !15
116 %tmp = tail call %10* @hoge(%6* undef, %0* undef, i32 signext 0, i32 signext 0), !dbg !16
117 call void @llvm.dbg.value(metadata %10* %tmp, metadata !10, metadata !DIExpression()), !dbg !16
118 br label %bb4, !dbg !17
121 unreachable, !dbg !18
123 bb4: ; preds = %bb2, %bb1
124 %tmp5 = phi %10* [ undef, %bb1 ], [ %tmp, %bb2 ], !dbg !19
125 call void @llvm.dbg.value(metadata %10* %tmp5, metadata !12, metadata !DIExpression()), !dbg !19
126 %tmp6 = bitcast %10* %tmp5 to %0*, !dbg !20
127 call void @llvm.dbg.value(metadata %0* %tmp6, metadata !13, metadata !DIExpression()), !dbg !20
128 ret %0* %tmp6, !dbg !21
131 declare %10* @hoge(%6*, %0*, i32, i32) #0
133 ; Function Attrs: nounwind readnone speculatable
134 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
136 attributes #0 = { "target-cpu"="z13" }
137 attributes #1 = { nounwind readnone speculatable "target-cpu"="z13" }
139 !llvm.module.flags = !{!0, !1}
141 !llvm.debugify = !{!5, !6}
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: "/")
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)
170 tracksRegLiveness: true