brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · af4b875 Raw
59 lines · plain
1; REQUIRES: x86-registered-target2; RUN: opt -S %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof | opt -S -passes='require<profile-summary>,function(codegenprepare)' | FileCheck %s3; RUN: opt -S %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof | opt -S -passes='require<profile-summary>,function(codegenprepare)' -profile-unknown-in-special-section -partial-profile | FileCheck %s --check-prefix=UNKNOWN4; RUN: opt -S %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof -profile-sample-accurate -S | opt -S -passes='require<profile-summary>,function(codegenprepare)' | FileCheck %s --check-prefix=ACCURATE5 6target triple = "x86_64-pc-linux-gnu"7 8; The test checks that function without profile gets unlikely section prefix9; if -profile-sample-accurate is specified or the function has the10; profile-sample-accurate attribute.11 12declare void @hot_func()13 14; CHECK-NOT: foo_not_in_profile{{.*}}!section_prefix15; CHECK: foo_not_in_profile{{.*}}!prof ![[NOPROFILE_ID:[0-9]+]]16; UNKNOWN: foo_not_in_profile{{.*}}!prof ![[NOPROFILE_ID:[0-9]+]] !section_prefix ![[UNKNOWN_ID:[0-9]+]]17; ACCURATE: foo_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]18; The function not appearing in profile is cold when -profile-sample-accurate19; is on.20define void @foo_not_in_profile() #1 {21  call void @hot_func()22  ret void23}24 25; CHECK: bar_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]26; ACCURATE: bar_not_in_profile{{.*}}!prof ![[ZERO_ID:[0-9]+]] !section_prefix ![[COLD_ID:[0-9]+]]27; The function not appearing in profile is cold when the func has28; profile-sample-accurate attribute.29define void @bar_not_in_profile() #0 {30  call void @hot_func()31  ret void32}33 34attributes #0 = { "profile-sample-accurate" "use-sample-profile" }35attributes #1 = { "use-sample-profile" }36 37; CHECK: ![[NOPROFILE_ID]] = !{!"function_entry_count", i64 -1}38; CHECK: ![[ZERO_ID]] = !{!"function_entry_count", i64 0}39; CHECK: ![[COLD_ID]] = !{!"section_prefix", !"unlikely"}40; UNKNOWN: ![[NOPROFILE_ID]] = !{!"function_entry_count", i64 -1}41; UNKNOWN: ![[UNKNOWN_ID]] = !{!"section_prefix", !"unknown"}42; ACCURATE: ![[ZERO_ID]] = !{!"function_entry_count", i64 0}43; ACCURATE: ![[COLD_ID]] = !{!"section_prefix", !"unlikely"}44!llvm.module.flags = !{!1}45!1 = !{i32 1, !"ProfileSummary", !2}46!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}47!3 = !{!"ProfileFormat", !"SampleProfile"}48!4 = !{!"TotalCount", i64 10000}49!5 = !{!"MaxCount", i64 1000}50!6 = !{!"MaxInternalCount", i64 1}51!7 = !{!"MaxFunctionCount", i64 1000}52!8 = !{!"NumCounts", i64 3}53!9 = !{!"NumFunctions", i64 3}54!10 = !{!"DetailedSummary", !11}55!11 = !{!12, !13, !14}56!12 = !{i32 10000, i64 100, i32 1}57!13 = !{i32 999000, i64 100, i32 1}58!14 = !{i32 999999, i64 1, i32 2}59