[llvm] 11a53f4 - Revert "[InstrProfiling] Use nobits as __llvm_prf_cnts section type in ELF"

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 00:41:56 PST 2021


Author: Petr Hosek
Date: 2021-02-24T00:41:43-08:00
New Revision: 11a53f47fb3448c747e18519f3799c919ec65aa1

URL: https://github.com/llvm/llvm-project/commit/11a53f47fb3448c747e18519f3799c919ec65aa1
DIFF: https://github.com/llvm/llvm-project/commit/11a53f47fb3448c747e18519f3799c919ec65aa1.diff

LOG: Revert "[InstrProfiling] Use nobits as __llvm_prf_cnts section type in ELF"

This reverts commit 6b286d93f7ec8518c685a302269e44b06a0a24f3 because
in some cases when the optimizer evaluates the global initializer,
__llvm_prf_cnts may not be entirely zero initialized.

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Removed: 
    llvm/test/Instrumentation/InstrProfiling/X86/nobits.ll


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index c1383ba61c80..2530fdc90378 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -440,10 +440,6 @@ static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K) {
       Name == ".llvmbc" || Name == ".llvmcmd")
     return SectionKind::getMetadata();
 
-  if (Name == getInstrProfSectionName(IPSK_cnts, Triple::ELF,
-                                      /*AddSegmentInfo=*/false))
-    return SectionKind::getBSS();
-
   if (Name.empty() || Name[0] != '.') return K;
 
   // Default implementation based on some magic section names.

diff  --git a/llvm/test/Instrumentation/InstrProfiling/X86/nobits.ll b/llvm/test/Instrumentation/InstrProfiling/X86/nobits.ll
deleted file mode 100644
index d8cbc76c8671..000000000000
--- a/llvm/test/Instrumentation/InstrProfiling/X86/nobits.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-;; Ensure that SHT_NOBITS section type is set for __llvm_prf_cnts in ELF.
-; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
-
- at __profc_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
-
-define void @foo() {
-  %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0), align 4
-  %1 = add i64 %pgocount, 1
-  store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0), align 4
-  ret void
-}
-
-declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
-
-; CHECK: .section __llvm_prf_cnts,"aw", at nobits


        


More information about the llvm-commits mailing list