blob: 8d76c33f8ff54401e25731dce02b318c8d799ae0 [file] [log] [blame]
# Check that the codegenprepare succeeds in dupRetToEnableTailCallOpts() also
# in the presence of a call to @llvm.dbg.value()
#
# RUN: llc %s -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=codegenprepare \
# RUN: -stop-after codegenprepare -o - | FileCheck %s
#
# CHECK-LABEL: bb2:
# CHECK: ret
# CHECK-LABEL: bb4:
# CHECK: ret
# Generated with:
#
# bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 -stop-before codegenprepare -simplify-mir
#
# %0 = type { i32 (...)**, i16, %1* }
# %1 = type { i32 (...)** }
# %2 = type { i32 (...)**, %1*, i8, i32, i32, i32, i16, i32, i16, i32, i16*, %3*, %6*, %9 }
# %3 = type { %4 }
# %4 = type { i32 (...)**, i8, i32, i32, %5**, %1* }
# %5 = type { i32, i32 }
# %6 = type { %7*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %1* }
# %7 = type { %8 }
# %8 = type { i32 (...)**, i8, i32, i32, %0**, %1* }
# %9 = type { i8* }
# %10 = type { %0, i32, i32, %0* }
#
# define %0* @Fun(%2* %arg) !dbg !7 {
# bb:
# switch i32 undef, label %bb3 [
# i32 58, label %bb1
# i32 41, label %bb2
# ], !dbg !14
#
# bb1: ; preds = %bb
# br label %bb4, !dbg !15
#
# bb2: ; preds = %bb
# %tmp = tail call %10* @hoge(%6* undef, %0* undef, i32 signext 0, i32 signext 0), !dbg !16
# call void @llvm.dbg.value(metadata %10* %tmp, metadata !10, metadata !DIExpression()), !dbg !16
# br label %bb4, !dbg !17
#
# bb3: ; preds = %bb
# unreachable, !dbg !18
#
# bb4: ; preds = %bb2, %bb1
# %tmp5 = phi %10* [ undef, %bb1 ], [ %tmp, %bb2 ], !dbg !19
# call void @llvm.dbg.value(metadata %10* %tmp5, metadata !12, metadata !DIExpression()), !dbg !19
# %tmp6 = bitcast %10* %tmp5 to %0*, !dbg !20
# call void @llvm.dbg.value(metadata %0* %tmp6, metadata !13, metadata !DIExpression()), !dbg !20
# ret %0* %tmp6, !dbg !21
# }
#
# declare %10* @hoge(%6*, %0*, i32, i32)
#
# ; Function Attrs: nounwind readnone speculatable
# declare void @llvm.dbg.value(metadata, metadata, metadata) #1
#
# attributes #0 = { "use-soft-float"="false" }
# attributes #1 = { nounwind readnone speculatable }
#
# !llvm.module.flags = !{!0, !1}
# !llvm.dbg.cu = !{!2}
# !llvm.debugify = !{!5, !6}
#
# !0 = !{i32 2, !"Debug Info Version", i32 3}
# !1 = !{i32 1, !"wchar_size", i32 4}
# !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
# !3 = !DIFile(filename: "tc.ll", directory: "/")
# !4 = !{}
# !5 = !{i32 8}
# !6 = !{i32 3}
# !7 = distinct !DISubprogram(name: "eggs", linkageName: "eggs", scope: null, file: !3, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !9)
# !8 = !DISubroutineType(types: !4)
# !9 = !{!10, !12, !13}
# !10 = !DILocalVariable(name: "1", scope: !7, file: !3, line: 3, type: !11)
# !11 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
# !12 = !DILocalVariable(name: "2", scope: !7, file: !3, line: 6, type: !11)
# !13 = !DILocalVariable(name: "3", scope: !7, file: !3, line: 7, type: !11)
# !14 = !DILocation(line: 1, column: 1, scope: !7)
# !15 = !DILocation(line: 2, column: 1, scope: !7)
# !16 = !DILocation(line: 3, column: 1, scope: !7)
# !17 = !DILocation(line: 4, column: 1, scope: !7)
# !18 = !DILocation(line: 5, column: 1, scope: !7)
# !19 = !DILocation(line: 6, column: 1, scope: !7)
# !20 = !DILocation(line: 7, column: 1, scope: !7)
# !21 = !DILocation(line: 8, column: 1, scope: !7)
--- |
%0 = type { i32 (...)**, i16, %1* }
%1 = type { i32 (...)** }
%2 = type { i32 (...)**, %1*, i8, i32, i32, i32, i16, i32, i16, i32, i16*, %3*, %6*, %9 }
%3 = type { %4 }
%4 = type { i32 (...)**, i8, i32, i32, %5**, %1* }
%5 = type { i32, i32 }
%6 = type { %7*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %0*, %1* }
%7 = type { %8 }
%8 = type { i32 (...)**, i8, i32, i32, %0**, %1* }
%9 = type { i8* }
%10 = type { %0, i32, i32, %0* }
define %0* @Fun(%2* %arg) #0 !dbg !7 {
bb:
switch i32 undef, label %bb3 [
i32 58, label %bb1
i32 41, label %bb2
], !dbg !14
bb1: ; preds = %bb
br label %bb4, !dbg !15
bb2: ; preds = %bb
%tmp = tail call %10* @hoge(%6* undef, %0* undef, i32 signext 0, i32 signext 0), !dbg !16
call void @llvm.dbg.value(metadata %10* %tmp, metadata !10, metadata !DIExpression()), !dbg !16
br label %bb4, !dbg !17
bb3: ; preds = %bb
unreachable, !dbg !18
bb4: ; preds = %bb2, %bb1
%tmp5 = phi %10* [ undef, %bb1 ], [ %tmp, %bb2 ], !dbg !19
call void @llvm.dbg.value(metadata %10* %tmp5, metadata !12, metadata !DIExpression()), !dbg !19
%tmp6 = bitcast %10* %tmp5 to %0*, !dbg !20
call void @llvm.dbg.value(metadata %0* %tmp6, metadata !13, metadata !DIExpression()), !dbg !20
ret %0* %tmp6, !dbg !21
}
declare %10* @hoge(%6*, %0*, i32, i32) #0
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
attributes #0 = { "target-cpu"="z13" }
attributes #1 = { nounwind readnone speculatable "target-cpu"="z13" }
!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}
!llvm.debugify = !{!5, !6}
!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
!3 = !DIFile(filename: "tc.ll", directory: "/")
!4 = !{}
!5 = !{i32 8}
!6 = !{i32 3}
!7 = distinct !DISubprogram(name: "eggs", linkageName: "eggs", scope: null, file: !3, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !9)
!8 = !DISubroutineType(types: !4)
!9 = !{!10, !12, !13}
!10 = !DILocalVariable(name: "1", scope: !7, file: !3, line: 3, type: !11)
!11 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
!12 = !DILocalVariable(name: "2", scope: !7, file: !3, line: 6, type: !11)
!13 = !DILocalVariable(name: "3", scope: !7, file: !3, line: 7, type: !11)
!14 = !DILocation(line: 1, column: 1, scope: !7)
!15 = !DILocation(line: 2, column: 1, scope: !7)
!16 = !DILocation(line: 3, column: 1, scope: !7)
!17 = !DILocation(line: 4, column: 1, scope: !7)
!18 = !DILocation(line: 5, column: 1, scope: !7)
!19 = !DILocation(line: 6, column: 1, scope: !7)
!20 = !DILocation(line: 7, column: 1, scope: !7)
!21 = !DILocation(line: 8, column: 1, scope: !7)
...
---
name: Fun
alignment: 4
tracksRegLiveness: true
...