diff options
author | Rong Xu <xur@google.com> | 2019-09-30 18:11:22 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2019-09-30 18:11:22 +0000 |
commit | 367405008755640eac6114b18ec8c98be0cf5392 (patch) | |
tree | 51ff7ce3153f83a9b81381374a5ee4dcb29621ac /llvm/lib/Transforms | |
parent | cc382cf72736294a409a4d79db11f0cbc3cc5ae1 (diff) | |
download | bcm5719-llvm-367405008755640eac6114b18ec8c98be0cf5392.tar.gz bcm5719-llvm-367405008755640eac6114b18ec8c98be0cf5392.zip |
[PGO] Don't group COMDAT variables for compiler generated profile variables in ELF
With this patch, compiler generated profile variables will have its own COMDAT
name for ELF format, which syncs the behavior with COFF. Tested with clang
PGO bootstrap. This shows a modest reduction in object sizes in ELF format.
Differential Revision: https://reviews.llvm.org/D68041
llvm-svn: 373241
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 5c1df16b073..0b83abe5bc2 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -758,7 +758,6 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { // of the parent function, that will result in relocations against discarded // sections. bool NeedComdat = needsComdatForCounter(*Fn, *M); - Comdat *Cmdt = nullptr; // Comdat group. if (NeedComdat) { if (TT.isOSBinFormatCOFF()) { // For COFF, put the counters, data, and values each into their own @@ -767,14 +766,11 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { // with the same name marked IMAGE_COMDAT_SELECT_ASSOCIATIVE. Linkage = GlobalValue::LinkOnceODRLinkage; Visibility = GlobalValue::HiddenVisibility; - } else { - // Otherwise, create one comdat group for everything. - Cmdt = M->getOrInsertComdat(getVarName(Inc, getInstrProfComdatPrefix())); } } auto MaybeSetComdat = [=](GlobalVariable *GV) { if (NeedComdat) - GV->setComdat(Cmdt ? Cmdt : M->getOrInsertComdat(GV->getName())); + GV->setComdat(M->getOrInsertComdat(GV->getName())); }; uint64_t NumCounters = Inc->getNumCounters()->getZExtValue(); |