[PATCH] D79600: [TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno-unique-section-names
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 12 14:33:02 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG66055230bf66: [TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno… (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79600/new/
https://reviews.llvm.org/D79600
Files:
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/test/Transforms/CodeGenPrepare/X86/section.ll
Index: llvm/test/Transforms/CodeGenPrepare/X86/section.ll
===================================================================
--- llvm/test/Transforms/CodeGenPrepare/X86/section.ll
+++ llvm/test/Transforms/CodeGenPrepare/X86/section.ll
@@ -1,10 +1,14 @@
; RUN: opt < %s -codegenprepare -S | FileCheck %s
+; RUN: llc < %s | FileCheck --check-prefix=ASM1 %s
+; RUN: llc < %s -function-sections | FileCheck --check-prefix=ASM2 %s
target triple = "x86_64-pc-linux-gnu"
; This tests that hot/cold functions get correct section prefix assigned
; CHECK: hot_func1{{.*}}!section_prefix ![[HOT_ID:[0-9]+]]
+; ASM1: .section .text.hot.,"ax", at progbits
+; ASM2: .section .text.hot.hot_func1,"ax", at progbits
; The entry is hot
define void @hot_func1() !prof !15 {
ret void
@@ -40,6 +44,8 @@
; not call site VP metadata (which can exist on value profiled memcpy,
; or possibly left behind after static analysis based devirtualization).
; CHECK: cold_func1{{.*}}!section_prefix ![[COLD_ID:[0-9]+]]
+; ASM1: .section .text.unlikely.,"ax", at progbits
+; ASM2: .section .text.unlikely.cold_func1,"ax", at progbits
define void @cold_func1() !prof !16 {
call void @hot_func1(), !prof !17
call void @hot_func1(), !prof !17
Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -611,15 +611,19 @@
Name = getSectionPrefixForGlobal(Kind);
}
+ bool HasPrefix = false;
if (const auto *F = dyn_cast<Function>(GO)) {
- if (Optional<StringRef> Prefix = F->getSectionPrefix())
+ if (Optional<StringRef> Prefix = F->getSectionPrefix()) {
Name += *Prefix;
+ HasPrefix = true;
+ }
}
if (UniqueSectionName) {
Name.push_back('.');
TM.getNameWithPrefix(Name, GO, Mang, /*MayAlwaysUsePrivate*/true);
- }
+ } else if (HasPrefix)
+ Name.push_back('.');
return Name;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79600.263517.patch
Type: text/x-patch
Size: 1994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200512/0ebce50c/attachment.bin>
More information about the llvm-commits
mailing list