<div dir="auto">My bad. For reference, I reverted this because it was causing some linker errors due to use of undefined sancov symbols.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 16, 2019, 10:09 Philip Reames <<a href="mailto:listmail@philipreames.com">listmail@philipreames.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Reminder: Please indicate *why* something is reverted when doing so.<br>
<br>
On 7/15/19 4:18 PM, Leonard Chan via llvm-commits wrote:<br>
> Author: leonardchan<br>
> Date: Mon Jul 15 16:18:31 2019<br>
> New Revision: 366153<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=366153&view=rev" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=366153&view=rev</a><br>
> Log:<br>
> Revert "[NewPM] Port Sancov"<br>
><br>
> This reverts commit 5652f35817f07b16f8b3856d594cc42f4d7ee29c.<br>
><br>
> Removed:<br>
> llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h<br>
> Modified:<br>
> llvm/trunk/include/llvm/InitializePasses.h<br>
> llvm/trunk/include/llvm/Transforms/Instrumentation.h<br>
> llvm/trunk/lib/Passes/PassBuilder.cpp<br>
> llvm/trunk/lib/Passes/PassRegistry.def<br>
> llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/trace-pc-guard-comdat.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/trace-pc-guard-inline-8bit-counters.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/trace-pc-guard-nocomdat.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/unreachable-critedge.ll<br>
> llvm/trunk/test/Instrumentation/SanitizerCoverage/wineh.ll<br>
><br>
> Modified: llvm/trunk/include/llvm/InitializePasses.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/InitializePasses.h (original)<br>
> +++ llvm/trunk/include/llvm/InitializePasses.h Mon Jul 15 16:18:31 2019<br>
> @@ -360,9 +360,7 @@ void initializeSROALegacyPassPass(PassRe<br>
> void initializeSafeStackLegacyPassPass(PassRegistry&);<br>
> void initializeSafepointIRVerifierPass(PassRegistry&);<br>
> void initializeSampleProfileLoaderLegacyPassPass(PassRegistry&);<br>
> -void initializeSanitizerCoverageFunctionCheckLegacyPassPass(PassRegistry &);<br>
> -void initializeSanitizerCoverageLegacyPassPass(PassRegistry &);<br>
> -void initializeModuleSanitizerCoverageLegacyPassPass(PassRegistry &);<br>
> +void initializeSanitizerCoverageModulePass(PassRegistry&);<br>
> void initializeScalarEvolutionWrapperPassPass(PassRegistry&);<br>
> void initializeScalarizeMaskedMemIntrinPass(PassRegistry&);<br>
> void initializeScalarizerLegacyPassPass(PassRegistry&);<br>
><br>
> Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original)<br>
> +++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Mon Jul 15 16:18:31 2019<br>
> @@ -181,6 +181,10 @@ struct SanitizerCoverageOptions {<br>
> SanitizerCoverageOptions() = default;<br>
> };<br>
> <br>
> +// Insert SanitizerCoverage instrumentation.<br>
> +ModulePass *createSanitizerCoverageModulePass(<br>
> + const SanitizerCoverageOptions &Options = SanitizerCoverageOptions());<br>
> +<br>
> /// Calculate what to divide by to scale counts.<br>
> ///<br>
> /// Given the maximum count, calculate a divisor that will scale all the<br>
><br>
> Removed: llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h?rev=366152&view=auto" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h?rev=366152&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h (original)<br>
> +++ llvm/trunk/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h (removed)<br>
> @@ -1,62 +0,0 @@<br>
> -//===--------- Definition of the SanitizerCoverage class --------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
> -// See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
> -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -//<br>
> -// This file declares the SanitizerCoverage class which is a port of the legacy<br>
> -// SanitizerCoverage pass to use the new PassManager infrastructure.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H<br>
> -#define LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H<br>
> -<br>
> -#include "llvm/IR/Function.h"<br>
> -#include "llvm/IR/Module.h"<br>
> -#include "llvm/IR/PassManager.h"<br>
> -#include "llvm/Transforms/Instrumentation.h"<br>
> -<br>
> -namespace llvm {<br>
> -<br>
> -/// This is the SanitizerCoverage pass used in the new pass manager. The<br>
> -/// pass instruments functions for coverage.<br>
> -class SanitizerCoveragePass : public PassInfoMixin<SanitizerCoveragePass> {<br>
> -public:<br>
> - explicit SanitizerCoveragePass(<br>
> - SanitizerCoverageOptions Options = SanitizerCoverageOptions())<br>
> - : Options(Options) {}<br>
> - PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);<br>
> -<br>
> -private:<br>
> - SanitizerCoverageOptions Options;<br>
> -};<br>
> -<br>
> -/// This is the ModuleSanitizerCoverage pass used in the new pass manager. This<br>
> -/// adds initialization calls to the module for trace PC guards and 8bit<br>
> -/// counters if they are requested.<br>
> -class ModuleSanitizerCoveragePass<br>
> - : public PassInfoMixin<ModuleSanitizerCoveragePass> {<br>
> -public:<br>
> - explicit ModuleSanitizerCoveragePass(<br>
> - SanitizerCoverageOptions Options = SanitizerCoverageOptions())<br>
> - : Options(Options) {}<br>
> - PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);<br>
> -<br>
> -private:<br>
> - SanitizerCoverageOptions Options;<br>
> -};<br>
> -<br>
> -// Insert SanitizerCoverage instrumentation.<br>
> -FunctionPass *createSanitizerCoverageLegacyPassPass(<br>
> - const SanitizerCoverageOptions &Options = SanitizerCoverageOptions());<br>
> -ModulePass *createModuleSanitizerCoverageLegacyPassPass(<br>
> - const SanitizerCoverageOptions &Options = SanitizerCoverageOptions());<br>
> -<br>
> -} // namespace llvm<br>
> -<br>
> -#endif<br>
><br>
> Modified: llvm/trunk/lib/Passes/PassBuilder.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Passes/PassBuilder.cpp (original)<br>
> +++ llvm/trunk/lib/Passes/PassBuilder.cpp Mon Jul 15 16:18:31 2019<br>
> @@ -101,7 +101,6 @@<br>
> #include "llvm/Transforms/Instrumentation/MemorySanitizer.h"<br>
> #include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"<br>
> #include "llvm/Transforms/Instrumentation/PoisonChecking.h"<br>
> -#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"<br>
> #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"<br>
> #include "llvm/Transforms/Scalar/ADCE.h"<br>
> #include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"<br>
> @@ -144,8 +143,8 @@<br>
> #include "llvm/Transforms/Scalar/LowerWidenableCondition.h"<br>
> #include "llvm/Transforms/Scalar/MakeGuardsExplicit.h"<br>
> #include "llvm/Transforms/Scalar/MemCpyOptimizer.h"<br>
> -#include "llvm/Transforms/Scalar/MergeICmps.h"<br>
> #include "llvm/Transforms/Scalar/MergedLoadStoreMotion.h"<br>
> +#include "llvm/Transforms/Scalar/MergeICmps.h"<br>
> #include "llvm/Transforms/Scalar/NaryReassociate.h"<br>
> #include "llvm/Transforms/Scalar/NewGVN.h"<br>
> #include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h"<br>
><br>
> Modified: llvm/trunk/lib/Passes/PassRegistry.def<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Passes/PassRegistry.def (original)<br>
> +++ llvm/trunk/lib/Passes/PassRegistry.def Mon Jul 15 16:18:31 2019<br>
> @@ -86,7 +86,6 @@ MODULE_PASS("wholeprogramdevirt", WholeP<br>
> MODULE_PASS("verify", VerifierPass())<br>
> MODULE_PASS("asan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/false, false, true, false))<br>
> MODULE_PASS("kasan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/true, false, true, false))<br>
> -MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass())<br>
> MODULE_PASS("poison-checking", PoisonCheckingPass())<br>
> #undef MODULE_PASS<br>
> <br>
> @@ -246,7 +245,6 @@ FUNCTION_PASS("khwasan", HWAddressSaniti<br>
> FUNCTION_PASS("msan", MemorySanitizerPass({}))<br>
> FUNCTION_PASS("kmsan", MemorySanitizerPass({0, false, /*Kernel=*/true}))<br>
> FUNCTION_PASS("tsan", ThreadSanitizerPass())<br>
> -FUNCTION_PASS("sancov-func", SanitizerCoveragePass())<br>
> #undef FUNCTION_PASS<br>
> <br>
> #ifndef FUNCTION_PASS_WITH_PARAMS<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp Mon Jul 15 16:18:31 2019<br>
> @@ -116,7 +116,7 @@ void llvm::initializeInstrumentation(Pas<br>
> initializeMemorySanitizerLegacyPassPass(Registry);<br>
> initializeHWAddressSanitizerLegacyPassPass(Registry);<br>
> initializeThreadSanitizerLegacyPassPass(Registry);<br>
> - initializeSanitizerCoverageLegacyPassPass(Registry);<br>
> + initializeSanitizerCoverageModulePass(Registry);<br>
> initializeDataFlowSanitizerPass(Registry);<br>
> }<br>
> <br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Mon Jul 15 16:18:31 2019<br>
> @@ -10,7 +10,6 @@<br>
> //<br>
> //===----------------------------------------------------------------------===//<br>
> <br>
> -#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"<br>
> #include "llvm/ADT/ArrayRef.h"<br>
> #include "llvm/ADT/SmallVector.h"<br>
> #include "llvm/Analysis/EHPersonalities.h"<br>
> @@ -177,158 +176,24 @@ SanitizerCoverageOptions OverrideFromCL(<br>
> return Options;<br>
> }<br>
> <br>
> -bool canInstrumentWithSancov(const Function &F) {<br>
> - if (F.empty())<br>
> - return false;<br>
> - if (F.getName().find(".module_ctor") != std::string::npos)<br>
> - return false; // Should not instrument sanitizer init functions.<br>
> - if (F.getName().startswith("__sanitizer_"))<br>
> - return false; // Don't instrument __sanitizer_* callbacks.<br>
> - // Don't touch available_externally functions, their actual body is elewhere.<br>
> - if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage)<br>
> - return false;<br>
> - // Don't instrument MSVC CRT configuration helpers. They may run before normal<br>
> - // initialization.<br>
> - if (F.getName() == "__local_stdio_printf_options" ||<br>
> - F.getName() == "__local_stdio_scanf_options")<br>
> - return false;<br>
> - if (isa<UnreachableInst>(F.getEntryBlock().getTerminator()))<br>
> - return false;<br>
> - // Don't instrument functions using SEH for now. Splitting basic blocks like<br>
> - // we do for coverage breaks WinEHPrepare.<br>
> - // FIXME: Remove this when SEH no longer uses landingpad pattern matching.<br>
> - if (F.hasPersonalityFn() &&<br>
> - isAsynchronousEHPersonality(classifyEHPersonality(F.getPersonalityFn())))<br>
> - return false;<br>
> - return true;<br>
> -}<br>
> -<br>
> -/// This is a class for instrumenting the module to add calls to initializing<br>
> -/// the trace PC guards and 8bit counter globals. This should only be done<br>
> -/// though if there is at least one function that can be instrumented with<br>
> -/// Sancov.<br>
> -class ModuleSanitizerCoverage {<br>
> +class SanitizerCoverageModule : public ModulePass {<br>
> public:<br>
> - ModuleSanitizerCoverage(const SanitizerCoverageOptions &Options)<br>
> - : Options(OverrideFromCL(Options)) {}<br>
> -<br>
> - bool instrumentModule(Module &M) {<br>
> - if (Options.CoverageType == SanitizerCoverageOptions::SCK_None)<br>
> - return false;<br>
> -<br>
> - Function *Ctor = nullptr;<br>
> - LLVMContext *C = &(M.getContext());<br>
> - const DataLayout *DL = &M.getDataLayout();<br>
> - TargetTriple = Triple(M.getTargetTriple());<br>
> - IntptrTy = Type::getIntNTy(*C, DL->getPointerSizeInBits());<br>
> - Type *IntptrPtrTy = PointerType::getUnqual(IntptrTy);<br>
> - IRBuilder<> IRB(*C);<br>
> - Type *Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty());<br>
> - Int8PtrTy = PointerType::getUnqual(IRB.getInt8Ty());<br>
> - Int8Ty = IRB.getInt8Ty();<br>
> -<br>
> - // Check that the __sancov_lowest_stack marker does not already exist.<br>
> - Constant *SanCovLowestStackConstant =<br>
> - M.getOrInsertGlobal(SanCovLowestStackName, IntptrTy);<br>
> - GlobalVariable *SanCovLowestStack =<br>
> - dyn_cast<GlobalVariable>(SanCovLowestStackConstant);<br>
> - if (!SanCovLowestStack) {<br>
> - C->emitError(StringRef("'") + SanCovLowestStackName +<br>
> - "' should not be declared by the user");<br>
> - return true;<br>
> - }<br>
> -<br>
> - // We want to emit guard init calls if the module contains a function that<br>
> - // we can instrument with SanitizerCoverage. We ignore any functions that<br>
> - // were inserted by SanitizerCoverage and get the result from the analysis<br>
> - // that checks for a valid function that the analysis may have run over.<br>
> - if (!llvm::any_of(<br>
> - M, [](const Function &F) { return canInstrumentWithSancov(F); }))<br>
> - return false;<br>
> -<br>
> - // Emit the init calls.<br>
> - if (Options.TracePCGuard)<br>
> - Ctor = CreateInitCallsForSections(M, SanCovModuleCtorTracePcGuardName,<br>
> - SanCovTracePCGuardInitName, Int32PtrTy,<br>
> - SanCovGuardsSectionName);<br>
> - if (Options.Inline8bitCounters)<br>
> - Ctor = CreateInitCallsForSections(M, SanCovModuleCtor8bitCountersName,<br>
> - SanCov8bitCountersInitName, Int8PtrTy,<br>
> - SanCovCountersSectionName);<br>
> - if (Ctor && Options.PCTable) {<br>
> - auto SecStartEnd =<br>
> - CreateSecStartEnd(M, SanCovPCsSectionName, IntptrPtrTy);<br>
> - FunctionCallee InitFunction = declareSanitizerInitFunction(<br>
> - M, SanCovPCsInitName, {IntptrPtrTy, IntptrPtrTy});<br>
> - IRBuilder<> IRBCtor(Ctor->getEntryBlock().getTerminator());<br>
> - IRBCtor.CreateCall(InitFunction, {SecStartEnd.first, SecStartEnd.second});<br>
> - }<br>
> - return Ctor;<br>
> - }<br>
> -<br>
> -private:<br>
> - Function *CreateInitCallsForSections(Module &M, const char *CtorName,<br>
> - const char *InitFunctionName, Type *Ty,<br>
> - const char *Section);<br>
> - std::pair<Value *, Value *> CreateSecStartEnd(Module &M, const char *Section,<br>
> - Type *Ty);<br>
> - std::string getSectionStart(const std::string &Section) const {<br>
> - if (TargetTriple.isOSBinFormatMachO())<br>
> - return "\1section$start$__DATA$__" + Section;<br>
> - return "__start___" + Section;<br>
> - }<br>
> - std::string getSectionEnd(const std::string &Section) const {<br>
> - if (TargetTriple.isOSBinFormatMachO())<br>
> - return "\1section$end$__DATA$__" + Section;<br>
> - return "__stop___" + Section;<br>
> + SanitizerCoverageModule(<br>
> + const SanitizerCoverageOptions &Options = SanitizerCoverageOptions())<br>
> + : ModulePass(ID), Options(OverrideFromCL(Options)) {<br>
> + initializeSanitizerCoverageModulePass(*PassRegistry::getPassRegistry());<br>
> }<br>
> + bool runOnModule(Module &M) override;<br>
> + bool runOnFunction(Function &F);<br>
> + static char ID; // Pass identification, replacement for typeid<br>
> + StringRef getPassName() const override { return "SanitizerCoverageModule"; }<br>
> <br>
> - SanitizerCoverageOptions Options;<br>
> - Triple TargetTriple;<br>
> - Type *IntptrTy, *Int8PtrTy, *Int8Ty;<br>
> -};<br>
> -<br>
> -class ModuleSanitizerCoverageLegacyPass : public ModulePass {<br>
> -public:<br>
> - static char ID;<br>
> -<br>
> - ModuleSanitizerCoverageLegacyPass(<br>
> - SanitizerCoverageOptions Options = SanitizerCoverageOptions())<br>
> - : ModulePass(ID), Options(Options) {<br>
> - initializeModuleSanitizerCoverageLegacyPassPass(<br>
> - *PassRegistry::getPassRegistry());<br>
> - }<br>
> -<br>
> - bool runOnModule(Module &M) override {<br>
> - ModuleSanitizerCoverage ModuleSancov(Options);<br>
> - return ModuleSancov.instrumentModule(M);<br>
> - };<br>
> -<br>
> - StringRef getPassName() const override {<br>
> - return "ModuleSanitizerCoverageLegacyPass";<br>
> - }<br>
> -<br>
> -private:<br>
> - SanitizerCoverageOptions Options;<br>
> -};<br>
> -<br>
> -char ModuleSanitizerCoverageLegacyPass::ID = 0;<br>
> -<br>
> -class SanitizerCoverage {<br>
> -public:<br>
> - SanitizerCoverage(Function &F, const SanitizerCoverageOptions &Options)<br>
> - : CurModule(F.getParent()), Options(OverrideFromCL(Options)) {<br>
> - initializeModule(*F.getParent());<br>
> + void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
> + AU.addRequired<DominatorTreeWrapperPass>();<br>
> + AU.addRequired<PostDominatorTreeWrapperPass>();<br>
> }<br>
> <br>
> - ~SanitizerCoverage() { finalizeModule(*CurModule); }<br>
> -<br>
> - bool instrumentFunction(Function &F, const DominatorTree *DT,<br>
> - const PostDominatorTree *PDT);<br>
> -<br>
> private:<br>
> - void initializeModule(Module &M);<br>
> - void finalizeModule(Module &M);<br>
> void InjectCoverageForIndirectCalls(Function &F,<br>
> ArrayRef<Instruction *> IndirCalls);<br>
> void InjectTraceForCmp(Function &F, ArrayRef<Instruction *> CmpTraceTargets);<br>
> @@ -347,6 +212,11 @@ private:<br>
> void CreateFunctionLocalArrays(Function &F, ArrayRef<BasicBlock *> AllBlocks);<br>
> void InjectCoverageAtBlock(Function &F, BasicBlock &BB, size_t Idx,<br>
> bool IsLeafFunc = true);<br>
> + Function *CreateInitCallsForSections(Module &M, const char *CtorName,<br>
> + const char *InitFunctionName, Type *Ty,<br>
> + const char *Section);<br>
> + std::pair<Value *, Value *> CreateSecStartEnd(Module &M, const char *Section,<br>
> + Type *Ty);<br>
> <br>
> void SetNoSanitizeMetadata(Instruction *I) {<br>
> I->setMetadata(I->getModule()->getMDKindID("nosanitize"),<br>
> @@ -354,6 +224,8 @@ private:<br>
> }<br>
> <br>
> std::string getSectionName(const std::string &Section) const;<br>
> + std::string getSectionStart(const std::string &Section) const;<br>
> + std::string getSectionEnd(const std::string &Section) const;<br>
> FunctionCallee SanCovTracePCIndir;<br>
> FunctionCallee SanCovTracePC, SanCovTracePCGuard;<br>
> FunctionCallee SanCovTraceCmpFunction[4];<br>
> @@ -380,63 +252,10 @@ private:<br>
> SanitizerCoverageOptions Options;<br>
> };<br>
> <br>
> -class SanitizerCoverageLegacyPass : public FunctionPass {<br>
> -public:<br>
> - static char ID; // Pass identification, replacement for typeid<br>
> -<br>
> - SanitizerCoverageLegacyPass(<br>
> - SanitizerCoverageOptions Options = SanitizerCoverageOptions())<br>
> - : FunctionPass(ID), Options(Options) {<br>
> - initializeSanitizerCoverageLegacyPassPass(*PassRegistry::getPassRegistry());<br>
> - }<br>
> -<br>
> - bool runOnFunction(Function &F) override {<br>
> - const DominatorTree *DT =<br>
> - &getAnalysis<DominatorTreeWrapperPass>().getDomTree();<br>
> - const PostDominatorTree *PDT =<br>
> - &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();<br>
> - SanitizerCoverage Sancov(F, Options);<br>
> - return Sancov.instrumentFunction(F, DT, PDT);<br>
> - }<br>
> -<br>
> - StringRef getPassName() const override {<br>
> - return "SanitizerCoverageLegacyPass";<br>
> - }<br>
> -<br>
> - void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
> - // Make the module sancov pass required by this pass so that it runs when<br>
> - // -sancov is passed.<br>
> - AU.addRequired<ModuleSanitizerCoverageLegacyPass>();<br>
> - AU.addRequired<DominatorTreeWrapperPass>();<br>
> - AU.addRequired<PostDominatorTreeWrapperPass>();<br>
> - }<br>
> -<br>
> -private:<br>
> - SanitizerCoverageOptions Options;<br>
> -};<br>
> -<br>
> } // namespace<br>
> <br>
> -PreservedAnalyses SanitizerCoveragePass::run(Function &F,<br>
> - FunctionAnalysisManager &AM) {<br>
> - const DominatorTree *DT = &AM.getResult<DominatorTreeAnalysis>(F);<br>
> - const PostDominatorTree *PDT = &AM.getResult<PostDominatorTreeAnalysis>(F);<br>
> - SanitizerCoverage Sancov(F, Options);<br>
> - if (Sancov.instrumentFunction(F, DT, PDT))<br>
> - return PreservedAnalyses::none();<br>
> - return PreservedAnalyses::all();<br>
> -}<br>
> -<br>
> -PreservedAnalyses ModuleSanitizerCoveragePass::run(Module &M,<br>
> - ModuleAnalysisManager &AM) {<br>
> - ModuleSanitizerCoverage ModuleSancov(Options);<br>
> - if (ModuleSancov.instrumentModule(M))<br>
> - return PreservedAnalyses::none();<br>
> - return PreservedAnalyses::all();<br>
> -}<br>
> -<br>
> std::pair<Value *, Value *><br>
> -ModuleSanitizerCoverage::CreateSecStartEnd(Module &M, const char *Section,<br>
> +SanitizerCoverageModule::CreateSecStartEnd(Module &M, const char *Section,<br>
> Type *Ty) {<br>
> GlobalVariable *SecStart =<br>
> new GlobalVariable(M, Ty, false, GlobalVariable::ExternalLinkage, nullptr,<br>
> @@ -446,7 +265,6 @@ ModuleSanitizerCoverage::CreateSecStartE<br>
> new GlobalVariable(M, Ty, false, GlobalVariable::ExternalLinkage,<br>
> nullptr, getSectionEnd(Section));<br>
> SecEnd->setVisibility(GlobalValue::HiddenVisibility);<br>
> -<br>
> IRBuilder<> IRB(M.getContext());<br>
> Value *SecEndPtr = IRB.CreatePointerCast(SecEnd, Ty);<br>
> if (!TargetTriple.isOSBinFormatCOFF())<br>
> @@ -460,7 +278,7 @@ ModuleSanitizerCoverage::CreateSecStartE<br>
> return std::make_pair(IRB.CreatePointerCast(GEP, Ty), SecEndPtr);<br>
> }<br>
> <br>
> -Function *ModuleSanitizerCoverage::CreateInitCallsForSections(<br>
> +Function *SanitizerCoverageModule::CreateInitCallsForSections(<br>
> Module &M, const char *CtorName, const char *InitFunctionName, Type *Ty,<br>
> const char *Section) {<br>
> auto SecStartEnd = CreateSecStartEnd(M, Section, Ty);<br>
> @@ -492,11 +310,12 @@ Function *ModuleSanitizerCoverage::Creat<br>
> return CtorFunc;<br>
> }<br>
> <br>
> -void SanitizerCoverage::initializeModule(Module &M) {<br>
> +bool SanitizerCoverageModule::runOnModule(Module &M) {<br>
> if (Options.CoverageType == SanitizerCoverageOptions::SCK_None)<br>
> - return;<br>
> + return false;<br>
> C = &(M.getContext());<br>
> DL = &M.getDataLayout();<br>
> + CurModule = &M;<br>
> CurModuleUniqueId = getUniqueModuleId(CurModule);<br>
> TargetTriple = Triple(M.getTargetTriple());<br>
> FunctionGuardArray = nullptr;<br>
> @@ -564,6 +383,11 @@ void SanitizerCoverage::initializeModule<br>
> Constant *SanCovLowestStackConstant =<br>
> M.getOrInsertGlobal(SanCovLowestStackName, IntptrTy);<br>
> SanCovLowestStack = dyn_cast<GlobalVariable>(SanCovLowestStackConstant);<br>
> + if (!SanCovLowestStack) {<br>
> + C->emitError(StringRef("'") + SanCovLowestStackName +<br>
> + "' should not be declared by the user");<br>
> + return true;<br>
> + }<br>
> SanCovLowestStack->setThreadLocalMode(<br>
> GlobalValue::ThreadLocalMode::InitialExecTLSModel);<br>
> if (Options.StackDepth && !SanCovLowestStack->isDeclaration())<br>
> @@ -577,14 +401,33 @@ void SanitizerCoverage::initializeModule<br>
> SanCovTracePC = M.getOrInsertFunction(SanCovTracePCName, VoidTy);<br>
> SanCovTracePCGuard =<br>
> M.getOrInsertFunction(SanCovTracePCGuardName, VoidTy, Int32PtrTy);<br>
> -}<br>
> <br>
> -void SanitizerCoverage::finalizeModule(Module &M) {<br>
> + for (auto &F : M)<br>
> + runOnFunction(F);<br>
> +<br>
> + Function *Ctor = nullptr;<br>
> +<br>
> + if (FunctionGuardArray)<br>
> + Ctor = CreateInitCallsForSections(M, SanCovModuleCtorTracePcGuardName,<br>
> + SanCovTracePCGuardInitName, Int32PtrTy,<br>
> + SanCovGuardsSectionName);<br>
> + if (Function8bitCounterArray)<br>
> + Ctor = CreateInitCallsForSections(M, SanCovModuleCtor8bitCountersName,<br>
> + SanCov8bitCountersInitName, Int8PtrTy,<br>
> + SanCovCountersSectionName);<br>
> + if (Ctor && Options.PCTable) {<br>
> + auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, IntptrPtrTy);<br>
> + FunctionCallee InitFunction = declareSanitizerInitFunction(<br>
> + M, SanCovPCsInitName, {IntptrPtrTy, IntptrPtrTy});<br>
> + IRBuilder<> IRBCtor(Ctor->getEntryBlock().getTerminator());<br>
> + IRBCtor.CreateCall(InitFunction, {SecStartEnd.first, SecStartEnd.second});<br>
> + }<br>
> // We don't reference these arrays directly in any of our runtime functions,<br>
> // so we need to prevent them from being dead stripped.<br>
> if (TargetTriple.isOSBinFormatMachO())<br>
> appendToUsed(M, GlobalsToAppendToUsed);<br>
> appendToCompilerUsed(M, GlobalsToAppendToCompilerUsed);<br>
> + return true;<br>
> }<br>
> <br>
> // True if block has successors and it dominates all of them.<br>
> @@ -675,11 +518,28 @@ static bool IsInterestingCmp(ICmpInst *C<br>
> return true;<br>
> }<br>
> <br>
> -bool SanitizerCoverage::instrumentFunction(Function &F, const DominatorTree *DT,<br>
> - const PostDominatorTree *PDT) {<br>
> - if (Options.CoverageType == SanitizerCoverageOptions::SCK_None)<br>
> +bool SanitizerCoverageModule::runOnFunction(Function &F) {<br>
> + if (F.empty())<br>
> + return false;<br>
> + if (F.getName().find(".module_ctor") != std::string::npos)<br>
> + return false; // Should not instrument sanitizer init functions.<br>
> + if (F.getName().startswith("__sanitizer_"))<br>
> + return false; // Don't instrument __sanitizer_* callbacks.<br>
> + // Don't touch available_externally functions, their actual body is elewhere.<br>
> + if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage)<br>
> return false;<br>
> - if (!canInstrumentWithSancov(F))<br>
> + // Don't instrument MSVC CRT configuration helpers. They may run before normal<br>
> + // initialization.<br>
> + if (F.getName() == "__local_stdio_printf_options" ||<br>
> + F.getName() == "__local_stdio_scanf_options")<br>
> + return false;<br>
> + if (isa<UnreachableInst>(F.getEntryBlock().getTerminator()))<br>
> + return false;<br>
> + // Don't instrument functions using SEH for now. Splitting basic blocks like<br>
> + // we do for coverage breaks WinEHPrepare.<br>
> + // FIXME: Remove this when SEH no longer uses landingpad pattern matching.<br>
> + if (F.hasPersonalityFn() &&<br>
> + isAsynchronousEHPersonality(classifyEHPersonality(F.getPersonalityFn())))<br>
> return false;<br>
> if (Options.CoverageType >= SanitizerCoverageOptions::SCK_Edge)<br>
> SplitAllCriticalEdges(F, CriticalEdgeSplittingOptions().setIgnoreUnreachableDests());<br>
> @@ -690,6 +550,10 @@ bool SanitizerCoverage::instrumentFuncti<br>
> SmallVector<BinaryOperator *, 8> DivTraceTargets;<br>
> SmallVector<GetElementPtrInst *, 8> GepTraceTargets;<br>
> <br>
> + const DominatorTree *DT =<br>
> + &getAnalysis<DominatorTreeWrapperPass>(F).getDomTree();<br>
> + const PostDominatorTree *PDT =<br>
> + &getAnalysis<PostDominatorTreeWrapperPass>(F).getPostDomTree();<br>
> bool IsLeafFunc = true;<br>
> <br>
> for (auto &BB : F) {<br>
> @@ -732,7 +596,7 @@ bool SanitizerCoverage::instrumentFuncti<br>
> return true;<br>
> }<br>
> <br>
> -GlobalVariable *SanitizerCoverage::CreateFunctionLocalArrayInSection(<br>
> +GlobalVariable *SanitizerCoverageModule::CreateFunctionLocalArrayInSection(<br>
> size_t NumElements, Function &F, Type *Ty, const char *Section) {<br>
> ArrayType *ArrayTy = ArrayType::get(Ty, NumElements);<br>
> auto Array = new GlobalVariable(<br>
> @@ -755,8 +619,8 @@ GlobalVariable *SanitizerCoverage::Creat<br>
> }<br>
> <br>
> GlobalVariable *<br>
> -SanitizerCoverage::CreatePCArray(Function &F,<br>
> - ArrayRef<BasicBlock *> AllBlocks) {<br>
> +SanitizerCoverageModule::CreatePCArray(Function &F,<br>
> + ArrayRef<BasicBlock *> AllBlocks) {<br>
> size_t N = AllBlocks.size();<br>
> assert(N);<br>
> SmallVector<Constant *, 32> PCs;<br>
> @@ -782,7 +646,7 @@ SanitizerCoverage::CreatePCArray(Functio<br>
> return PCArray;<br>
> }<br>
> <br>
> -void SanitizerCoverage::CreateFunctionLocalArrays(<br>
> +void SanitizerCoverageModule::CreateFunctionLocalArrays(<br>
> Function &F, ArrayRef<BasicBlock *> AllBlocks) {<br>
> if (Options.TracePCGuard)<br>
> FunctionGuardArray = CreateFunctionLocalArrayInSection(<br>
> @@ -796,9 +660,9 @@ void SanitizerCoverage::CreateFunctionLo<br>
> FunctionPCsArray = CreatePCArray(F, AllBlocks);<br>
> }<br>
> <br>
> -bool SanitizerCoverage::InjectCoverage(Function &F,<br>
> - ArrayRef<BasicBlock *> AllBlocks,<br>
> - bool IsLeafFunc) {<br>
> +bool SanitizerCoverageModule::InjectCoverage(Function &F,<br>
> + ArrayRef<BasicBlock *> AllBlocks,<br>
> + bool IsLeafFunc) {<br>
> if (AllBlocks.empty()) return false;<br>
> CreateFunctionLocalArrays(F, AllBlocks);<br>
> for (size_t i = 0, N = AllBlocks.size(); i < N; i++)<br>
> @@ -813,7 +677,7 @@ bool SanitizerCoverage::InjectCoverage(F<br>
> // The cache is used to speed up recording the caller-callee pairs.<br>
> // The address of the caller is passed implicitly via caller PC.<br>
> // CacheSize is encoded in the name of the run-time function.<br>
> -void SanitizerCoverage::InjectCoverageForIndirectCalls(<br>
> +void SanitizerCoverageModule::InjectCoverageForIndirectCalls(<br>
> Function &F, ArrayRef<Instruction *> IndirCalls) {<br>
> if (IndirCalls.empty())<br>
> return;<br>
> @@ -832,7 +696,7 @@ void SanitizerCoverage::InjectCoverageFo<br>
> // __sanitizer_cov_trace_switch(CondValue,<br>
> // {NumCases, ValueSizeInBits, Case0Value, Case1Value, Case2Value, ... })<br>
> <br>
> -void SanitizerCoverage::InjectTraceForSwitch(<br>
> +void SanitizerCoverageModule::InjectTraceForSwitch(<br>
> Function &, ArrayRef<Instruction *> SwitchTraceTargets) {<br>
> for (auto I : SwitchTraceTargets) {<br>
> if (SwitchInst *SI = dyn_cast<SwitchInst>(I)) {<br>
> @@ -871,7 +735,7 @@ void SanitizerCoverage::InjectTraceForSw<br>
> }<br>
> }<br>
> <br>
> -void SanitizerCoverage::InjectTraceForDiv(<br>
> +void SanitizerCoverageModule::InjectTraceForDiv(<br>
> Function &, ArrayRef<BinaryOperator *> DivTraceTargets) {<br>
> for (auto BO : DivTraceTargets) {<br>
> IRBuilder<> IRB(BO);<br>
> @@ -889,7 +753,7 @@ void SanitizerCoverage::InjectTraceForDi<br>
> }<br>
> }<br>
> <br>
> -void SanitizerCoverage::InjectTraceForGep(<br>
> +void SanitizerCoverageModule::InjectTraceForGep(<br>
> Function &, ArrayRef<GetElementPtrInst *> GepTraceTargets) {<br>
> for (auto GEP : GepTraceTargets) {<br>
> IRBuilder<> IRB(GEP);<br>
> @@ -900,7 +764,7 @@ void SanitizerCoverage::InjectTraceForGe<br>
> }<br>
> }<br>
> <br>
> -void SanitizerCoverage::InjectTraceForCmp(<br>
> +void SanitizerCoverageModule::InjectTraceForCmp(<br>
> Function &, ArrayRef<Instruction *> CmpTraceTargets) {<br>
> for (auto I : CmpTraceTargets) {<br>
> if (ICmpInst *ICMP = dyn_cast<ICmpInst>(I)) {<br>
> @@ -935,8 +799,9 @@ void SanitizerCoverage::InjectTraceForCm<br>
> }<br>
> }<br>
> <br>
> -void SanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,<br>
> - size_t Idx, bool IsLeafFunc) {<br>
> +void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,<br>
> + size_t Idx,<br>
> + bool IsLeafFunc) {<br>
> BasicBlock::iterator IP = BB.getFirstInsertionPt();<br>
> bool IsEntryBB = &BB == &F.getEntryBlock();<br>
> DebugLoc EntryLoc;<br>
> @@ -993,7 +858,7 @@ void SanitizerCoverage::InjectCoverageAt<br>
> }<br>
> <br>
> std::string<br>
> -SanitizerCoverage::getSectionName(const std::string &Section) const {<br>
> +SanitizerCoverageModule::getSectionName(const std::string &Section) const {<br>
> if (TargetTriple.isOSBinFormatCOFF()) {<br>
> if (Section == SanCovCountersSectionName)<br>
> return ".SCOV$CM";<br>
> @@ -1006,25 +871,33 @@ SanitizerCoverage::getSectionName(const<br>
> return "__" + Section;<br>
> }<br>
> <br>
> -INITIALIZE_PASS(ModuleSanitizerCoverageLegacyPass, "module-sancov",<br>
> - "Pass for inserting sancov top-level initialization calls",<br>
> - false, false)<br>
> -<br>
> -char SanitizerCoverageLegacyPass::ID = 0;<br>
> -INITIALIZE_PASS_BEGIN(SanitizerCoverageLegacyPass, "sancov",<br>
> - "Pass for instrumenting coverage on functions", false,<br>
> - false)<br>
> -INITIALIZE_PASS_DEPENDENCY(ModuleSanitizerCoverageLegacyPass)<br>
> +std::string<br>
> +SanitizerCoverageModule::getSectionStart(const std::string &Section) const {<br>
> + if (TargetTriple.isOSBinFormatMachO())<br>
> + return "\1section$start$__DATA$__" + Section;<br>
> + return "__start___" + Section;<br>
> +}<br>
> +<br>
> +std::string<br>
> +SanitizerCoverageModule::getSectionEnd(const std::string &Section) const {<br>
> + if (TargetTriple.isOSBinFormatMachO())<br>
> + return "\1section$end$__DATA$__" + Section;<br>
> + return "__stop___" + Section;<br>
> +}<br>
> +<br>
> +<br>
> +char SanitizerCoverageModule::ID = 0;<br>
> +INITIALIZE_PASS_BEGIN(SanitizerCoverageModule, "sancov",<br>
> + "SanitizerCoverage: TODO."<br>
> + "ModulePass",<br>
> + false, false)<br>
> INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)<br>
> INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)<br>
> -INITIALIZE_PASS_END(SanitizerCoverageLegacyPass, "sancov",<br>
> - "Pass for instrumenting coverage on functions", false,<br>
> - false)<br>
> -FunctionPass *llvm::createSanitizerCoverageLegacyPassPass(<br>
> - const SanitizerCoverageOptions &Options) {<br>
> - return new SanitizerCoverageLegacyPass(Options);<br>
> -}<br>
> -ModulePass *llvm::createModuleSanitizerCoverageLegacyPassPass(<br>
> +INITIALIZE_PASS_END(SanitizerCoverageModule, "sancov",<br>
> + "SanitizerCoverage: TODO."<br>
> + "ModulePass",<br>
> + false, false)<br>
> +ModulePass *llvm::createSanitizerCoverageModulePass(<br>
> const SanitizerCoverageOptions &Options) {<br>
> - return new ModuleSanitizerCoverageLegacyPass(Options);<br>
> + return new SanitizerCoverageModule(Options);<br>
> }<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/abort-in-entry-block.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Checks that a function with no-return in the entry block is not instrumented.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s<br>
> ; CHECK-NOT: call void @__sanitizer_cov_trace_pc_guard<br>
> <br>
> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/backedge-pruning.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,8 +1,6 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1 and how it prunes backedge compares.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=PRUNE<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -sanitizer-coverage-prune-blocks=0 -S | FileCheck %s --check-prefix=NOPRUNE<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=PRUNE<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -sanitizer-coverage-prune-blocks=0 -S | FileCheck %s --check-prefix=NOPRUNE<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/chains.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,5 +1,4 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s<br>
> <br>
> define i32 @blah(i32) #0 {<br>
> %2 = icmp sgt i32 %0, 1<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_32.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1 API declarations on a non-x86_64 arch<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> <br>
> target triple = "i386-unknown-linux-gnu"<br>
> define i32 @foo() #0 {<br>
> @@ -8,16 +7,16 @@ entry:<br>
> ret i32 0<br>
> }<br>
> <br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_indir(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp1(i8, i8)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp2(i16, i16)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp4(i32, i32)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_div4(i32)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_div8(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_gep(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_switch(i64, i64*)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc()<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_guard(i32*)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_guard_init(i32*, i32*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_indir(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp1(i8, i8)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp2(i16, i16)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp4(i32, i32)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp8(i64, i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_div4(i32)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_div8(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_gep(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_switch(i64, i64*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc()<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_guard(i32*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_guard_init(i32*, i32*)<br>
> ; CHECK-NOT: declare<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing-api-x86_64.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1 API declarations on x86_64<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> <br>
> target triple = "x86_64-unknown-linux-gnu"<br>
> define i32 @foo() #0 {<br>
> @@ -8,16 +7,16 @@ entry:<br>
> ret i32 0<br>
> }<br>
> <br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_indir(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp1(i8 zeroext, i8 zeroext)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_div4(i32 zeroext)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_div8(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_gep(i64)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_switch(i64, i64*)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc()<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_guard(i32*)<br>
> -; CHECK-DAG: declare void @__sanitizer_cov_trace_pc_guard_init(i32*, i32*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_indir(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp1(i8 zeroext, i8 zeroext)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_cmp8(i64, i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_div4(i32 zeroext)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_div8(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_gep(i64)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_switch(i64, i64*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc()<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_guard(i32*)<br>
> +; CHECK: declare void @__sanitizer_cov_trace_pc_guard_init(i32*, i32*)<br>
> ; CHECK-NOT: declare<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/cmp-tracing.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-comdat.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,5 +1,4 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> <br>
> ; Make sure we use the right comdat groups for COFF to avoid relocations<br>
> ; against discarded sections. Internal linkage functions are also different from<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-pc-table-inline-8bit-counters.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Checks that the PC and 8-bit Counter Arrays are placed in their own sections in COFF binaries.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-pc-windows-msvc19.14.26433"<br>
> <br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coff-used-ctor.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Checks that sancov.module_ctor is marked used.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-pc-windows-msvc19.14.26433"<br>
> <br>
> @@ -9,4 +8,4 @@ entry:<br>
> ret void<br>
> }<br>
> <br>
> -; CHECK: @llvm.used = appending global {{.*}} @sancov.module_ctor<br>
> +; CHECK: @llvm.used = appending global {{.*}} @sancov.module_ctor<br>
> \ No newline at end of file<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/const-cmp-tracing.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,7 +1,6 @@<br>
> ; Test that coverage instrumentation does not lose debug location.<br>
> <br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -S | FileCheck %s<br>
> <br>
> ; C++ source:<br>
> ; 1: struct A {<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,8 +1,6 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_TRACE_PC<br>
> -; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=CHECKPRUNE<br>
> <br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_TRACE_PC<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=CHECKPRUNE<br>
> +; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s --check-prefix=CHECKPRUNE<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,7 +1,6 @@<br>
> ; Test that coverage instrumentation does not lose debug location.<br>
> <br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=2 -S | FileCheck %s<br>
> <br>
> ; C++ source:<br>
> ; 1: void foo(int *a) {<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/div-tracing.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-divs=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-divs=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-divs=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/gep-tracing.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-geps=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-geps=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-geps=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-inline-8bit-counters=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -sanitizer-coverage-inline-8bit-counters=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/interposable-symbol-nocomdat.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,8 +1,6 @@<br>
> ; Test that interposable symbols do not get put in comdats.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -mtriple x86_64-linux-gnu -S | FileCheck %s<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -mtriple x86_64-windows-msvc -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -mtriple x86_64-linux-gnu -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -mtriple x86_64-windows-msvc -S | FileCheck %s<br>
> <br>
> define void @Vanilla() {<br>
> entry:<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/no-func.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,7 +1,6 @@<br>
> ; Tests that we don't insert __sanitizer_cov_trace_pc_guard_init or some such<br>
> ; when there is no instrumentation.<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s<br>
> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
> <br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/pc-table.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,8 +1,6 @@<br>
> ; Test -sanitizer-coverage-pc-table=1<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-pc-table=1 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/postdominator_check.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,7 +1,5 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=0 -S | FileCheck %s --check-prefix=CHECK_NO_PRUNE<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -sanitizer-coverage-prune-blocks=0 -S | FileCheck %s --check-prefix=CHECK_NO_PRUNE<br>
> <br>
> define i32 @foo(i32) #0 {<br>
> %2 = icmp sgt i32 %0, 0<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/seh.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,9 +1,6 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=0 -S | FileCheck %s<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -S | FileCheck %s<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=0 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=2 -S | FileCheck %s<br>
> <br>
> target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"<br>
> target triple = "i686-pc-windows-msvc18.0.0"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth-variable-declared-by-user.ll Mon Jul 15 16:18:31 2019<br>
> @@ -2,8 +2,6 @@<br>
> ; user declares `__sancov_lowest_stack` with an unexpected type.<br>
> ; RUN: not opt < %s -sancov -sanitizer-coverage-level=1 \<br>
> ; RUN: -sanitizer-coverage-stack-depth -S 2>&1 | FileCheck %s<br>
> -; RUN: not opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 \<br>
> -; RUN: -sanitizer-coverage-stack-depth -S 2>&1 | FileCheck %s<br>
> <br>
> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/stack-depth.ll Mon Jul 15 16:18:31 2019<br>
> @@ -4,11 +4,6 @@<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 \<br>
> ; RUN: -sanitizer-coverage-stack-depth -sanitizer-coverage-trace-pc-guard \<br>
> ; RUN: -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=1 \<br>
> -; RUN: -sanitizer-coverage-stack-depth -S | FileCheck %s<br>
> -; RUN: opt < %s -passes='module(sancov-module),function(sancov-func)' -sanitizer-coverage-level=3 \<br>
> -; RUN: -sanitizer-coverage-stack-depth -sanitizer-coverage-trace-pc-guard \<br>
> -; RUN: -S | FileCheck %s<br>
> <br>
> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
> target triple = "x86_64-unknown-linux-gnu"<br>
><br>
> Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll?rev=366153&r1=366152&r2=366153&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll (original)<br>
> +++ llvm/trunk/test/Instrumentation/SanitizerCoverage/switch-tracing.ll Mon Jul 15 16:18:31 2019<br>
> @@ -1,6 +1,5 @@<br>
> ; Test -sanitizer-coverage-trace-compares=1 (instrumenting a switch)<br>
> ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s<br>
</blockquote></div>