[PATCH] D32983: Fix code section prefix for proper layout

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 15:48:17 PDT 2017


tejohnson created this revision.

r284533 added hot and cold section prefixes based on profile
information, to enable grouping of hot/cold functions at link time.
However, it used "cold" as the prefix for cold sections, but gold only
recognizes "unlikely" (which is used by gcc for cold sections).
Therefore, cold sections were not properly being grouped. Switch to
using "unlikely"


https://reviews.llvm.org/D32983

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  test/Transforms/CodeGenPrepare/section.ll


Index: test/Transforms/CodeGenPrepare/section.ll
===================================================================
--- test/Transforms/CodeGenPrepare/section.ll
+++ test/Transforms/CodeGenPrepare/section.ll
@@ -35,7 +35,7 @@
 }
 
 ; CHECK: ![[HOT_ID]] = !{!"function_section_prefix", !".hot"}
-; CHECK: ![[COLD_ID]] = !{!"function_section_prefix", !".cold"}
+; CHECK: ![[COLD_ID]] = !{!"function_section_prefix", !".unlikely"}
 !llvm.module.flags = !{!1}
 !1 = !{i32 1, !"ProfileSummary", !2}
 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
Index: lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- lib/CodeGen/CodeGenPrepare.cpp
+++ lib/CodeGen/CodeGenPrepare.cpp
@@ -295,7 +295,7 @@
     if (PSI->isFunctionHotInCallGraph(&F))
       F.setSectionPrefix(".hot");
     else if (PSI->isFunctionColdInCallGraph(&F))
-      F.setSectionPrefix(".cold");
+      F.setSectionPrefix(".unlikely");
   }
 
   /// This optimization identifies DIV instructions that can be


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32983.98227.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/59fea8e0/attachment.bin>


More information about the llvm-commits mailing list