[PATCH] D69384: Add unlikely attribute to outlined function

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 14:50:15 PDT 2019


hiraditya updated this revision to Diff 226335.
hiraditya added a comment.

It is happening without my changes with -codegenprepare. So just keeping the testcase.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69384/new/

https://reviews.llvm.org/D69384

Files:
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/test/Transforms/HotColdSplit/coldentrycount.ll


Index: llvm/test/Transforms/HotColdSplit/coldentrycount.ll
===================================================================
--- llvm/test/Transforms/HotColdSplit/coldentrycount.ll
+++ llvm/test/Transforms/HotColdSplit/coldentrycount.ll
@@ -1,7 +1,7 @@
 ; Test to ensure that split cold function gets 0 entry count profile
 ; metadata when compiling with pgo.
 
-; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s
+; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=0 -codegenprepare -S < %s | FileCheck %s
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.14.0"
@@ -22,8 +22,9 @@
 
 declare void @sink() cold
 
-; CHECK: define {{.*}} @fun.cold.1{{.*}} ![[PROF:[0-9]+]]
+; CHECK: define {{.*}} @fun.cold.1{{.*}} ![[PROF:[0-9]+]] {{.*}}section_prefix ![[UNLIKELY:[0-9]+]]
 ; CHECK: ![[PROF]] = !{!"function_entry_count", i64 0}
+; CHECK: ![[UNLIKELY]] = !{!"function_section_prefix", !".unlikely"}
 
 !llvm.module.flags = !{!0}
 !0 = !{i32 1, !"ProfileSummary", !1}
@@ -41,3 +42,6 @@
 !12 = !{i32 999000, i64 100, i32 1}
 !13 = !{i32 999999, i64 1, i32 2}
 !14 = !{!"function_entry_count", i64 100}
+!15 = !{!"function_section_prefix", !".hot"}
+!16 = !{!"function_entry_count", i64 0}
+!17 = !{!"function_section_prefix", !".unlikely"}
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -433,6 +433,7 @@
 
   ProfileSummaryInfo *PSI =
       &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
+
   if (ProfileGuidedSectionPrefix) {
     if (PSI->isFunctionHotInCallGraph(&F, *BFI))
       F.setSectionPrefix(".hot");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69384.226335.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191024/f35bb929/attachment.bin>


More information about the llvm-commits mailing list