[PATCH] D112465: [llvm-profgen] Avoid writing any data to CSNameTableSection for the empty CSNameTable
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 25 09:56:52 PDT 2021
wlei created this revision.
Herald added subscribers: hoy, wenlei, lxfind, hiraditya.
wlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112465
Files:
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/test/tools/llvm-profgen/inline-noprobe2.test
Index: llvm/test/tools/llvm-profgen/inline-noprobe2.test
===================================================================
--- llvm/test/tools/llvm-profgen/inline-noprobe2.test
+++ llvm/test/tools/llvm-profgen/inline-noprobe2.test
@@ -6,6 +6,7 @@
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK
; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t
+; RUN: llvm-profdata show --show-sec-info-only -sample %t | FileCheck %s --check-prefix=CHECK-SECTION-INFO
; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST
; CHECK-ARTIFICIAL-BRANCH: 3
@@ -16,6 +17,9 @@
; CHECK-ARTIFICIAL-BRANCH: 400870->400540:2
; CHECK-ARTIFICIAL-BRANCH: 4008bf->400870:2
+; CHECK-SECTION-INFO: CSNameTableSection - Offset: [[#]], Size: 0, Flags: {}
+; CHECK-SECTION-INFO: FunctionMetadata - Offset: [[#]], Size: 0, Flags: {}
+
; CHECK-SYM-LIST: Dump profile symbol list
; CHECK-SYM-LIST: main
; CHECK-SYM-LIST: partition_pivot_first
Index: llvm/lib/ProfileData/SampleProfWriter.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProfWriter.cpp
+++ llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -252,6 +252,9 @@
}
std::error_code SampleProfileWriterExtBinaryBase::writeCSNameTableSection() {
+ if(CSNameTable.empty())
+ return sampleprof_error::success;
+
// Sort the names to make CSNameTable deterministic.
std::set<SampleContext> OrderedContexts;
for (const auto &I : CSNameTable)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112465.382034.patch
Type: text/x-patch
Size: 1591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211025/43a679eb/attachment.bin>
More information about the llvm-commits
mailing list