aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2016-07-21 20:50:02 +0000
committerRong Xu <xur@google.com>2016-07-21 20:50:02 +0000
commit97b68c5ebef82f9f8f24e179bd0e1902adfc9c61 (patch)
tree169821f09749daabe4d69d24de8ad4de11e99533 /llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
parent2deeb6093d65a9cf2adb81e5a60dd4aa105cabf7 (diff)
downloadllvm-97b68c5ebef82f9f8f24e179bd0e1902adfc9c61.zip
llvm-97b68c5ebef82f9f8f24e179bd0e1902adfc9c61.tar.gz
llvm-97b68c5ebef82f9f8f24e179bd0e1902adfc9c61.tar.bz2
[PGO] Make needsComdatForCounter() available (NFC)
Move needsComdatForCounter() to lib/ProfileData/InstrProf.cpp from lib/Transforms/Instrumentation/InstrProfiling.cpp to make is available for other files. Differential Revision: https://reviews.llvm.org/D22643 llvm-svn: 276330
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 0a06ce3..1b60b19 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -268,33 +268,6 @@ static inline bool shouldRecordFunctionAddr(Function *F) {
return F->hasAddressTaken() || F->hasLinkOnceLinkage();
}
-static inline bool needsComdatForCounter(Function &F, Module &M) {
-
- if (F.hasComdat())
- return true;
-
- Triple TT(M.getTargetTriple());
- if (!TT.isOSBinFormatELF())
- return false;
-
- // See createPGOFuncNameVar for more details. To avoid link errors, profile
- // counters for function with available_externally linkage needs to be changed
- // to linkonce linkage. On ELF based systems, this leads to weak symbols to be
- // created. Without using comdat, duplicate entries won't be removed by the
- // linker leading to increased data segement size and raw profile size. Even
- // worse, since the referenced counter from profile per-function data object
- // will be resolved to the common strong definition, the profile counts for
- // available_externally functions will end up being duplicated in raw profile
- // data. This can result in distorted profile as the counts of those dups
- // will be accumulated by the profile merger.
- GlobalValue::LinkageTypes Linkage = F.getLinkage();
- if (Linkage != GlobalValue::ExternalWeakLinkage &&
- Linkage != GlobalValue::AvailableExternallyLinkage)
- return false;
-
- return true;
-}
-
static inline Comdat *getOrCreateProfileComdat(Module &M, Function &F,
InstrProfIncrementInst *Inc) {
if (!needsComdatForCounter(F, M))