[PATCH] D51943: [GCOV] Remove function names from gcno when using option -coverage-no-function-names-in-data
calixte via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 10:52:01 PDT 2018
calixte created this revision.
calixte added reviewers: marco-c, chandlerc.
Herald added a subscriber: llvm-commits.
This option allows to remove function names from gcda but in this case they're pretty useless in gcno too.
So this patch just puts an empty string for function names when the option is enabled.
In a software like Firefox, we win ~140M in removing them from gcnos.
Repository:
rL LLVM
https://reviews.llvm.org/D51943
Files:
lib/Transforms/Instrumentation/GCOVProfiling.cpp
Index: lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -325,9 +325,10 @@
class GCOVFunction : public GCOVRecord {
public:
GCOVFunction(const DISubprogram *SP, Function *F, raw_ostream *os,
- uint32_t Ident, bool UseCfgChecksum, bool ExitBlockBeforeBody)
+ uint32_t Ident, bool UseCfgChecksum, bool ExitBlockBeforeBody,
+ bool FunctionNamesInData)
: SP(SP), Ident(Ident), UseCfgChecksum(UseCfgChecksum), CfgChecksum(0),
- ReturnBlock(1, os) {
+ FunctionNamesInData(FunctionNamesInData), ReturnBlock(1, os) {
this->os = os;
LLVM_DEBUG(dbgs() << "Function: " << getFunctionName(SP) << "\n");
@@ -388,7 +389,7 @@
write(FuncChecksum);
if (UseCfgChecksum)
write(CfgChecksum);
- writeGCOVString(getFunctionName(SP));
+ writeGCOVString(FunctionNamesInData ? getFunctionName(SP) : "");
writeGCOVString(SP->getFilename());
write(SP->getLine());
@@ -429,6 +430,7 @@
uint32_t FuncChecksum;
bool UseCfgChecksum;
uint32_t CfgChecksum;
+ bool FunctionNamesInData;
DenseMap<BasicBlock *, GCOVBlock> Blocks;
GCOVBlock ReturnBlock;
};
@@ -580,7 +582,8 @@
Funcs.push_back(make_unique<GCOVFunction>(SP, &F, &out, FunctionIdent++,
Options.UseCfgChecksum,
- Options.ExitBlockBeforeBody));
+ Options.ExitBlockBeforeBody,
+ Options.FunctionNamesInData));
GCOVFunction &Func = *Funcs.back();
for (auto &BB : F) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51943.164928.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/7f022e5a/attachment.bin>
More information about the llvm-commits
mailing list