[llvm] r336941 - [SanitizerCoverage] Add associated metadata to 8-bit counters.
Matt Morehouse via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 13:24:58 PDT 2018
Author: morehouse
Date: Thu Jul 12 13:24:58 2018
New Revision: 336941
URL: http://llvm.org/viewvc/llvm-project?rev=336941&view=rev
Log:
[SanitizerCoverage] Add associated metadata to 8-bit counters.
Summary:
This allows counters associated with unused functions to be
dead-stripped along with their functions. This approach is the same one
we used for PC tables.
Fixes an issue where LLD removes an unused PC table but leaves the 8-bit
counter.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: llvm-commits, hiraditya, kcc
Differential Revision: https://reviews.llvm.org/D49264
Modified:
llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=336941&r1=336940&r2=336941&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Thu Jul 12 13:24:58 2018
@@ -595,7 +595,9 @@ void SanitizerCoverageModule::CreateFunc
if (Options.Inline8bitCounters) {
Function8bitCounterArray = CreateFunctionLocalArrayInSection(
AllBlocks.size(), F, Int8Ty, SanCovCountersSectionName);
- GlobalsToAppendToUsed.push_back(Function8bitCounterArray);
+ GlobalsToAppendToCompilerUsed.push_back(Function8bitCounterArray);
+ MDNode *MD = MDNode::get(F.getContext(), ValueAsMetadata::get(&F));
+ Function8bitCounterArray->addMetadata(LLVMContext::MD_associated, *MD);
}
if (Options.PCTable) {
FunctionPCsArray = CreatePCArray(F, AllBlocks);
More information about the llvm-commits
mailing list