brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 96aa35f Raw
86 lines · plain
1; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=100 -S | FileCheck %s2target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"3target triple = "x86_64-unknown-linux-gnu"4 5; When 'callee' is inlined into caller1 and caller2, the indirect call and vtable6; value profiles of the inlined copy should be scaled based on callers' profiles.7; The indirect call and vtable value profiles in 'callee' should be updated.8define i32 @callee(ptr %0, i32 %1) !prof !19 {9; CHECK-LABEL: define i32 @callee(10; CHECK-SAME: ptr [[TMP0:%.*]], i32 [[TMP1:%.*]]) !prof [[PROF0:![0-9]+]] {11; CHECK-NEXT:    [[TMP3:%.*]] = load ptr, ptr [[TMP0]], align 8, !prof [[PROF1:![0-9]+]]12; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 813; CHECK-NEXT:    [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 814; CHECK-NEXT:    [[TMP6:%.*]] = tail call i32 [[TMP5]](ptr [[TMP0]], i32 [[TMP1]]), !prof [[PROF2:![0-9]+]]15; CHECK-NEXT:    ret i32 [[TMP6]]16;17  %3 = load ptr, ptr %0, !prof !1518  %5 = getelementptr inbounds i8, ptr %3, i64 819  %6 = load ptr, ptr %520  %7 = tail call i32 %6(ptr %0, i32 %1), !prof !1621  ret i32 %722}23 24define i32 @caller1(i32 %0) !prof !17 {25; CHECK-LABEL: define i32 @caller1(26; CHECK-SAME: i32 [[TMP0:%.*]]) !prof [[PROF3:![0-9]+]] {27; CHECK-NEXT:    [[TMP2:%.*]] = tail call ptr @_Z10createTypei(i32 [[TMP0]])28; CHECK-NEXT:    [[TMP3:%.*]] = load ptr, ptr [[TMP2]], align 8, !prof [[PROF4:![0-9]+]]29; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 830; CHECK-NEXT:    [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 831; CHECK-NEXT:    [[TMP6:%.*]] = tail call i32 [[TMP5]](ptr [[TMP2]], i32 [[TMP0]]), !prof [[PROF5:![0-9]+]]32; CHECK-NEXT:    ret i32 [[TMP6]]33;34  %2 = tail call ptr @_Z10createTypei(i32 %0)35  %3 = tail call i32 @callee(ptr %2, i32 %0)36  ret i32 %337}38 39define i32 @caller2(i32 %0) !prof !18  {40; CHECK-LABEL: define i32 @caller2(41; CHECK-SAME: i32 [[TMP0:%.*]]) !prof [[PROF6:![0-9]+]] {42; CHECK-NEXT:    [[TMP2:%.*]] = tail call ptr @_Z10createTypei(i32 [[TMP0]])43; CHECK-NEXT:    [[TMP3:%.*]] = load ptr, ptr [[TMP2]], align 8, !prof [[PROF7:![0-9]+]]44; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 845; CHECK-NEXT:    [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 846; CHECK-NEXT:    [[TMP6:%.*]] = tail call i32 [[TMP5]](ptr [[TMP2]], i32 [[TMP0]]), !prof [[PROF8:![0-9]+]]47; CHECK-NEXT:    ret i32 [[TMP6]]48;49  %2 = tail call ptr @_Z10createTypei(i32 %0)50  %3 = tail call i32 @callee(ptr %2, i32 %0)51  ret i32 %352}53 54declare ptr @_Z10createTypei(i32)55 56!1 = !{i32 1, !"ProfileSummary", !2}57!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}58!3 = !{!"ProfileFormat", !"InstrProf"}59!4 = !{!"TotalCount", i64 10000}60!5 = !{!"MaxCount", i64 10}61!6 = !{!"MaxInternalCount", i64 1}62!7 = !{!"MaxFunctionCount", i64 1000}63!8 = !{!"NumCounts", i64 3}64!9 = !{!"NumFunctions", i64 3}65!10 = !{!"DetailedSummary", !11}66!11 = !{!12, !13, !14}67!12 = !{i32 10000, i64 100, i32 1}68!13 = !{i32 999000, i64 100, i32 1}69!14 = !{i32 999999, i64 1, i32 2}70!15 = !{!"VP", i32 2, i64 1600, i64 321, i64 1000, i64 789, i64 600}71!16 = !{!"VP", i32 0, i64 1600, i64 123, i64 1000, i64 456, i64 600}72!17 = !{!"function_entry_count", i64 1000}73!18 = !{!"function_entry_count", i64 600}74!19 = !{!"function_entry_count", i64 1700}75;.76; CHECK: [[PROF0]] = !{!"function_entry_count", i64 100}77; CHECK: [[PROF1]] = !{!"VP", i32 2, i64 94, i64 321, i64 58, i64 789, i64 35}78; CHECK: [[PROF2]] = !{!"VP", i32 0, i64 94, i64 123, i64 58, i64 456, i64 35}79; CHECK: [[PROF3]] = !{!"function_entry_count", i64 1000}80; CHECK: [[PROF4]] = !{!"VP", i32 2, i64 941, i64 321, i64 588, i64 789, i64 352}81; CHECK: [[PROF5]] = !{!"VP", i32 0, i64 941, i64 123, i64 588, i64 456, i64 352}82; CHECK: [[PROF6]] = !{!"function_entry_count", i64 600}83; CHECK: [[PROF7]] = !{!"VP", i32 2, i64 564, i64 321, i64 352, i64 789, i64 211}84; CHECK: [[PROF8]] = !{!"VP", i32 0, i64 564, i64 123, i64 352, i64 456, i64 211}85;.86