diff options
Diffstat (limited to 'lib/Transforms/Instrumentation/InstrProfiling.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/InstrProfiling.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp index 0c0b54fe689..57ed2f784af 100644 --- a/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -279,16 +279,6 @@ static inline bool shouldRecordFunctionAddr(Function *F) { return F->hasAddressTaken(); } -static inline Comdat *getOrCreateProfileComdat(Module &M, - InstrProfIncrementInst *Inc) { - // COFF format requires a COMDAT section to have a key symbol with the same - // name. - StringRef ComdatPrefix = (Triple(M.getTargetTriple()).isOSBinFormatCOFF() - ? getInstrProfDataVarPrefix() - : getInstrProfComdatPrefix()); - return M.getOrInsertComdat(StringRef(getVarName(Inc, ComdatPrefix))); -} - GlobalVariable * InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { GlobalVariable *NamePtr = Inc->getName(); @@ -307,7 +297,8 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { Function *Fn = Inc->getParent()->getParent(); Comdat *ProfileVarsComdat = nullptr; if (Fn->hasComdat()) - ProfileVarsComdat = getOrCreateProfileComdat(*M, Inc); + ProfileVarsComdat = M->getOrInsertComdat( + StringRef(getVarName(Inc, getInstrProfComdatPrefix()))); NamePtr->setSection(getNameSection()); NamePtr->setAlignment(1); NamePtr->setComdat(ProfileVarsComdat); |