[PATCH] D17460: Add prefix based function layout when profile is available.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 11:55:33 PST 2016


danielcdh created this revision.
danielcdh added a reviewer: davidxl.
danielcdh added a subscriber: llvm-commits.

If a function is hot, put it in text.hot section.

http://reviews.llvm.org/D17460

Files:
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -294,6 +294,13 @@
     Name = getSectionPrefixForGlobal(Kind);
   }
 
+  // TODO: update when API is available to check if a function is hot.
+  if (const Function *F = dyn_cast<Function>(GV)) {
+    if (F->getEntryCount()) {
+      Name += ".hot";
+    }
+  }
+
   if (EmitUniqueSection && UniqueSectionNames) {
     Name.push_back('.');
     TM.getNameWithPrefix(Name, GV, Mang, true);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17460.48540.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160219/00b17b02/attachment.bin>


More information about the llvm-commits mailing list