[PATCH] D24989: Use profile info to set function section prefix to group hot/cold functions.

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 17:55:26 PDT 2016


eraman added inline comments.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:124
@@ +123,3 @@
+static cl::opt<bool> ProfileGuidedSectionPrefix(
+    "profile-guideded-section-prefix", cl::Hidden, cl::init(true),
+    cl::desc("Use profile info to add section prefix for hot/cold functions"));
----------------
Option name misspelt: guideded -> guided

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:246
@@ +245,3 @@
+        getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(*F.getParent());;
+    if (PSI->isHotFunction(&F))
+      F.setSectionPrefix(".hot");
----------------
isHotFunction and isColdFunction do not use the histogram based hotness/coldness information. It's probably fine to use this now and later change their implementation.

================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:305
@@ -299,2 +304,3 @@
+  }
   // FIXME: Extend the section prefix to include hotness catagories such as .hot
   //  or .unlikely for functions.
----------------
Remove the FIXME

================
Comment at: test/Transforms/CodeGenPrepare/section.ll:6
@@ +5,3 @@
+
+; CHECK-OPT: hot_func[[PROF:.*]]!section_prefix ![[HOT_ID:[0-9]*]]
+; CHECK-OPT: cold_func[[PROF:.*]]!section_prefix ![[COLD_ID:[0-9]*]]
----------------
You don't need the PROF variable since you don't use it later


https://reviews.llvm.org/D24989





More information about the llvm-commits mailing list