[llvm] r269726 - Remove .hot and .unlikely prefixes from function section names.

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 16:59:05 PDT 2016


Author: eraman
Date: Mon May 16 18:59:04 2016
New Revision: 269726

URL: http://llvm.org/viewvc/llvm-project?rev=269726&view=rev
Log:
Remove .hot and .unlikely prefixes from function section names.

This code currently relies on static methods in ProfileSummary to determine whether a function is hot or unlikley. I am refactoring the ProfileSummary code and these methods will be removed. As discussed offline, the right way to re-introduce this is to add a pass to annotate functions with unlikely/hot hints and use the hints to determine the prefix here.


Removed:
    llvm/trunk/test/CodeGen/X86/partition-sections.ll
Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=269726&r1=269725&r2=269726&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon May 16 18:59:04 2016
@@ -34,7 +34,6 @@
 #include "llvm/MC/MCSymbolELF.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/ProfileData/InstrProf.h"
-#include "llvm/ProfileData/ProfileCommon.h"
 #include "llvm/Support/COFF.h"
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ELF.h"
@@ -245,11 +244,6 @@ static StringRef getSectionPrefixForGlob
   return ".data.rel.ro";
 }
 
-static cl::opt<bool> GroupFunctionsByHotness(
-    "group-functions-by-hotness",
-    llvm::cl::desc("Partition hot/cold functions by sections prefix"),
-    cl::init(false));
-
 static MCSectionELF *
 selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
                           SectionKind Kind, Mangler &Mang,
@@ -301,16 +295,8 @@ selectELFSectionForGlobal(MCContext &Ctx
   } else {
     Name = getSectionPrefixForGlobal(Kind);
   }
-
-  if (GroupFunctionsByHotness) {
-    if (const Function *F = dyn_cast<Function>(GV)) {
-      if (ProfileSummary::isFunctionHot(F)) {
-        Name += getHotSectionPrefix();
-      } else if (ProfileSummary::isFunctionUnlikely(F)) {
-        Name += getUnlikelySectionPrefix();
-      }
-    }
-  }
+  // FIXME: Extend the section prefix to include hotness catagories such as .hot
+  //  or .unlikely for functions.
 
   if (EmitUniqueSection && UniqueSectionNames) {
     Name.push_back('.');

Removed: llvm/trunk/test/CodeGen/X86/partition-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/partition-sections.ll?rev=269725&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/partition-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/partition-sections.ll (removed)
@@ -1,31 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-pc-linux -group-functions-by-hotness=true | FileCheck %s -check-prefix=PARTITION
-; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -group-functions-by-hotness=false | FileCheck %s -check-prefix=NO-PARTITION-FUNCTION-SECTION
-; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -group-functions-by-hotness=true | FileCheck %s -check-prefix=PARTITION-FUNCTION-SECTION
-
-; PARTITION: .text.unlikely
-; PARTITION: .globl  _Z3foov
-; NO-PARTITION-FUNCTION-SECTION: .text._Z3foov
-; PARTITION-FUNCTION-SECTION: .text.unlikely._Z3foov
-define i32 @_Z3foov() #0 {
-  ret i32 0
-}
-
-; PARTITION: .globl  _Z3barv
-; NO-PARTITION-FUNCTION-SECTION: .text._Z3barv
-; PARTITION-FUNCTION-SECTION: .text.unlikely._Z3barv
-define i32 @_Z3barv() #1 !prof !0 {
-  ret i32 1
-}
-
-; PARTITION: .text
-; PARTITION: .globl  _Z3bazv
-; NO-PARTITION-FUNCTION-SECTION: .text._Z3bazv
-; PARTITION-FUNCTION-SECTION: .text._Z3bazv
-define i32 @_Z3bazv() #1 {
-  ret i32 2
-}
-
-attributes #0 = { nounwind uwtable cold }
-attributes #1 = { nounwind uwtable }
-
-!0 = !{!"function_entry_count", i64 0}




More information about the llvm-commits mailing list