1; RUN: opt -callsite-splitting -S < %s | FileCheck %s 2 3; CHECK-LABEL: @test1 4; CHECK: [[R1:%.+]] = call i32 @callee(i32 0, i32 %dd), !dbg [[DBG1:!.*]] 5; CHECK: [[R2:%.+]] = call i32 @callee(i32 1, i32 %dd), !dbg [[DBG1]] 6; CHECK-LABEL: CallSite: 7; CHECK-NEXT: phi i32 [ [[R2]], %land.rhs.split ], [ [[R1]], %entry.split ], !dbg [[DBG1]] 8 9define i32 @test1(i32* dereferenceable(4) %cc, i32 %dd) !dbg !6 { 10entry: 11 br i1 undef, label %CallSite, label %land.rhs 12 13land.rhs: ; preds = %entry 14 br label %CallSite 15 16CallSite: ; preds = %land.rhs, %entry 17 %pv = phi i32 [ 0, %entry ], [ 1, %land.rhs ] 18 %call = call i32 @callee(i32 %pv, i32 %dd), !dbg !18 19 ret i32 %call 20} 21 22; CHECK-LABEL: @test2 23; CHECK: [[LV1:%.*]] = load i32, i32* %ptr, align 4, !dbg [[DBG_LV:!.*]] 24; CHECK-NEXT: [[R1:%.+]] = call i32 @callee(i32 0, i32 10), !dbg [[DBG_CALL:!.*]] 25; CHECK: [[LV2:%.*]] = load i32, i32* %ptr, align 4, !dbg [[DBG_LV]] 26; CHECK-NEXT: [[R2:%.+]] = call i32 @callee(i32 0, i32 %i), !dbg [[DBG_CALL]] 27; CHECK-LABEL: CallSite: 28; CHECK-NEXT: phi i32 [ [[LV1]], %Header.split ], [ [[LV2]], %TBB.split ], !dbg [[DBG_LV]] 29; CHECK-NEXT: phi i32 [ [[R1]], %Header.split ], [ [[R2]], %TBB.split ], !dbg [[DBG_CALL]] 30 31define void @test2(i32* %ptr, i32 %i) !dbg !19 { 32Header: 33 %tobool = icmp ne i32 %i, 10 34 br i1 %tobool, label %TBB, label %CallSite 35 36TBB: ; preds = %Header 37 br i1 undef, label %CallSite, label %End 38 39CallSite: ; preds = %TBB, %Header 40 %lv = load i32, i32* %ptr, align 4, !dbg !25 41 %cv = call i32 @callee(i32 0, i32 %i), !dbg !26 42 %sub = sub nsw i32 %lv, %cv 43 br label %End 44 45End: ; preds = %CallSite, %TBB 46 ret void 47} 48 49define i32 @callee(i32 %aa, i32 %bb) { 50entry: 51 %add = add nsw i32 %aa, %bb 52 ret i32 %add 53} 54 55!llvm.dbg.cu = !{!0} 56!llvm.debugify = !{!3, !4} 57!llvm.module.flags = !{!5} 58 59!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 60!1 = !DIFile(filename: "<stdin>", directory: "/") 61!2 = !{} 62!3 = !{i32 23} 63!4 = !{i32 11} 64!5 = !{i32 2, !"Debug Info Version", i32 3} 65!6 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !8) 66!7 = !DISubroutineType(types: !2) 67!8 = !{!9, !11, !13, !15, !16, !17} 68!9 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 3, type: !10) 69!10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned) 70!11 = !DILocalVariable(name: "3", scope: !6, file: !1, line: 5, type: !12) 71!12 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) 72!13 = !DILocalVariable(name: "4", scope: !6, file: !1, line: 6, type: !14) 73!14 = !DIBasicType(name: "ty8", size: 8, encoding: DW_ATE_unsigned) 74!15 = !DILocalVariable(name: "5", scope: !6, file: !1, line: 9, type: !12) 75!16 = !DILocalVariable(name: "6", scope: !6, file: !1, line: 10, type: !12) 76!17 = !DILocalVariable(name: "7", scope: !6, file: !1, line: 11, type: !10) 77!18 = !DILocation(line: 10, column: 1, scope: !6) 78!19 = distinct !DISubprogram(name: "test_add_new_phi", linkageName: "test_add_new_phi", scope: null, file: !1, line: 14, type: !7, isLocal: false, isDefinition: true, scopeLine: 14, isOptimized: true, unit: !0, retainedNodes: !20) 79!20 = !{!21, !22, !23, !24} 80!21 = !DILocalVariable(name: "8", scope: !19, file: !1, line: 14, type: !14) 81!22 = !DILocalVariable(name: "9", scope: !19, file: !1, line: 17, type: !10) 82!23 = !DILocalVariable(name: "10", scope: !19, file: !1, line: 18, type: !12) 83!24 = !DILocalVariable(name: "11", scope: !19, file: !1, line: 20, type: !12) 84!25 = !DILocation(line: 18, column: 1, scope: !19) 85!26 = !DILocation(line: 19, column: 1, scope: !19) 86