1; Tests that instructions with value profiles and count-type branch weights are 2; updated in both caller and callee after inline, but invoke instructions with 3; taken or not taken branch probabilities are not updated. 4 5; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s 6 7declare i32 @__gxx_personality_v0(...) 8 9define void @caller(ptr %func) personality ptr @__gxx_personality_v0 !prof !15 { 10 call void @callee(ptr %func), !prof !16 11 12 ret void 13} 14 15declare void @callee1(ptr %func) 16 17declare void @callee2(ptr %func) 18 19define void @callee(ptr %obj) personality ptr @__gxx_personality_v0 !prof !17 { 20 %vtable = load ptr, ptr %obj, !prof !21 21 %func = load ptr, ptr %vtable 22 invoke void %func() 23 to label %next unwind label %lpad, !prof !18 24 25next: 26 invoke void @callee1(ptr %func) 27 to label %cont unwind label %lpad, !prof !19 28 29cont: 30 invoke void @callee2(ptr %func) 31 to label %ret unwind label %lpad, !prof !20 32 33lpad: 34 %exn = landingpad {ptr, i32} 35 cleanup 36 unreachable 37 38ret: 39 ret void 40} 41 42!llvm.module.flags = !{!1} 43!1 = !{i32 1, !"ProfileSummary", !2} 44!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} 45!3 = !{!"ProfileFormat", !"SampleProfile"} 46!4 = !{!"TotalCount", i64 10000} 47!5 = !{!"MaxCount", i64 10} 48!6 = !{!"MaxInternalCount", i64 1} 49!7 = !{!"MaxFunctionCount", i64 2000} 50!8 = !{!"NumCounts", i64 2} 51!9 = !{!"NumFunctions", i64 2} 52!10 = !{!"DetailedSummary", !11} 53!11 = !{!12, !13, !14} 54!12 = !{i32 10000, i64 100, i32 1} 55!13 = !{i32 999000, i64 100, i32 1} 56!14 = !{i32 999999, i64 1, i32 2} 57!15 = !{!"function_entry_count", i64 1000} 58!16 = !{!"branch_weights", i64 1000} 59!17 = !{!"function_entry_count", i32 1500} 60!18 = !{!"VP", i32 0, i64 1500, i64 123, i64 900, i64 456, i64 600} 61!19 = !{!"branch_weights", i32 1500} 62!20 = !{!"branch_weights", i32 1234, i32 5678} 63!21 = !{!"VP", i32 2, i64 1500, i64 789, i64 900, i64 321, i64 600} 64 65; CHECK-LABEL: define void @caller( 66; CHECK-SAME: ptr [[FUNC:%.*]]) personality ptr @__gxx_personality_v0 !prof [[PROF14:![0-9]+]] { 67; CHECK-NEXT: [[VTABLE_I:%.*]] = load ptr, ptr [[FUNC]], align 8, !prof [[PROF15:![0-9]+]] 68; CHECK-NEXT: [[FUNC_I:%.*]] = load ptr, ptr [[VTABLE_I]], align 8 69; CHECK-NEXT: invoke void [[FUNC_I]]() 70; CHECK-NEXT: to label %[[NEXT_I:.*]] unwind label %[[LPAD_I:.*]], !prof [[PROF16:![0-9]+]] 71; CHECK: [[NEXT_I]]: 72; CHECK-NEXT: invoke void @callee1(ptr [[FUNC_I]]) 73; CHECK-NEXT: to label %[[CONT_I:.*]] unwind label %[[LPAD_I]], !prof [[PROF17:![0-9]+]] 74; CHECK: [[CONT_I]]: 75; CHECK-NEXT: invoke void @callee2(ptr [[FUNC_I]]) 76; CHECK-NEXT: to label %[[CALLEE_EXIT:.*]] unwind label %[[LPAD_I]], !prof [[PROF18:![0-9]+]] 77; 78 79; CHECK-LABEL: define void @callee( 80; CHECK-SAME: ptr [[OBJ:%.*]]) personality ptr @__gxx_personality_v0 !prof [[PROF19:![0-9]+]] { 81; CHECK-NEXT: [[VTABLE:%.*]] = load ptr, ptr [[OBJ]], align 8, !prof [[PROF20:![0-9]+]] 82; CHECK-NEXT: [[FUNC:%.*]] = load ptr, ptr [[VTABLE]], align 8 83; CHECK-NEXT: invoke void [[FUNC]]() 84; CHECK-NEXT: to label %[[NEXT:.*]] unwind label %[[LPAD:.*]], !prof [[PROF21:![0-9]+]] 85; CHECK: [[NEXT]]: 86; CHECK-NEXT: invoke void @callee1(ptr [[FUNC]]) 87; CHECK-NEXT: to label %[[CONT:.*]] unwind label %[[LPAD]], !prof [[PROF22:![0-9]+]] 88; CHECK: [[CONT]]: 89; CHECK-NEXT: invoke void @callee2(ptr [[FUNC]]) 90; CHECK-NEXT: to label %[[RET:.*]] unwind label %[[LPAD]], !prof [[PROF18]] 91 92; CHECK: [[PROF14]] = !{!"function_entry_count", i64 1000} 93; CHECK: [[PROF15]] = !{!"VP", i32 2, i64 1000, i64 789, i64 600, i64 321, i64 400} 94; CHECK: [[PROF16]] = !{!"VP", i32 0, i64 1000, i64 123, i64 600, i64 456, i64 400} 95; CHECK: [[PROF17]] = !{!"branch_weights", i32 1000} 96; CHECK: [[PROF18]] = !{!"branch_weights", i32 1234, i32 5678} 97; CHECK: [[PROF19]] = !{!"function_entry_count", i64 500} 98; CHECK: [[PROF20]] = !{!"VP", i32 2, i64 500, i64 789, i64 300, i64 321, i64 200} 99; CHECK: [[PROF21]] = !{!"VP", i32 0, i64 500, i64 123, i64 300, i64 456, i64 200} 100; CHECK: [[PROF22]] = !{!"branch_weights", i32 500} 101