diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 2de7e6d1d0fdcb..1bb734863c7df4 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -627,7 +627,7 @@ static void addSanitizers(const Triple &TargetTriple, OptimizationLevel Level) { if (CodeGenOpts.hasSanitizeCoverage()) { auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts); - MPM.addPass(ModuleSanitizerCoveragePass( + MPM.addPass(SanitizerCoveragePass( SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles, CodeGenOpts.SanitizeCoverageIgnorelistFiles)); } diff --git a/clang/test/Driver/sancov.c b/clang/test/Driver/sancov.c index 64181ccf59a96c..44acfd3d8f3aaf 100644 --- a/clang/test/Driver/sancov.c +++ b/clang/test/Driver/sancov.c @@ -7,7 +7,7 @@ // RUN: %clang -target x86_64-unknown-linux -fsanitize-coverage=trace-pc-guard %s -S -emit-llvm -flto -o - | FileCheck %s // RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize-coverage=trace-pc-guard %s -S -emit-llvm -flto -o - | FileCheck %s -// Verify that -fsanitize-coverage invokes ModuleSanitizerCoveragePass instrumentation. +// Verify that -fsanitize-coverage invokes SanitizerCoveragePass instrumentation. int foo(int *a) { return *a; } // CHECK: _sancov_ diff --git a/llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h b/llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h index dfa85fde28e650..89ab4fd114fccf 100644 --- a/llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h +++ b/llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h @@ -27,10 +27,9 @@ class Module; /// pass instruments functions for coverage, adds initialization calls to the /// module for trace PC guards and 8bit counters if they are requested, and /// appends globals to llvm.compiler.used. -class ModuleSanitizerCoveragePass - : public PassInfoMixin { +class SanitizerCoveragePass : public PassInfoMixin { public: - explicit ModuleSanitizerCoveragePass( + explicit SanitizerCoveragePass( SanitizerCoverageOptions Options = SanitizerCoverageOptions(), const std::vector &AllowlistFiles = std::vector(), diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index 4a14fc785ba560..97b9f07529058a 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -121,7 +121,7 @@ MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass()) MODULE_PASS("dfsan", DataFlowSanitizerPass()) MODULE_PASS("module-inline", ModuleInlinerPass()) MODULE_PASS("tsan-module", ModuleThreadSanitizerPass()) -MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass()) +MODULE_PASS("sancov-module", SanitizerCoveragePass()) MODULE_PASS("memprof-module", ModuleMemProfilerPass()) MODULE_PASS("poison-checking", PoisonCheckingPass()) MODULE_PASS("pseudo-probe-update", PseudoProbeUpdatePass()) diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 095e3191ced177..7d717459387a6b 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -280,8 +280,8 @@ class ModuleSanitizerCoverage { }; } // namespace -PreservedAnalyses ModuleSanitizerCoveragePass::run(Module &M, - ModuleAnalysisManager &MAM) { +PreservedAnalyses SanitizerCoveragePass::run(Module &M, + ModuleAnalysisManager &MAM) { ModuleSanitizerCoverage ModuleSancov(Options, Allowlist.get(), Blocklist.get()); auto &FAM = MAM.getResult(M).getManager(); diff --git a/llvm/test/Instrumentation/SanitizerCoverage/crit-edge-sancov.ll b/llvm/test/Instrumentation/SanitizerCoverage/crit-edge-sancov.ll index 3f5542facb0d8b..f42fa7139fd585 100644 --- a/llvm/test/Instrumentation/SanitizerCoverage/crit-edge-sancov.ll +++ b/llvm/test/Instrumentation/SanitizerCoverage/crit-edge-sancov.ll @@ -2,8 +2,8 @@ ; RUN: -sanitizer-coverage-level=3 %s -S -o - | FileCheck %s ; The edge between %entry and %for.inc.i is a critical edge. -; ModuleSanitizerCoveragePass must split this critical edge in order to track -; coverage of this edge. ModuleSanitizerCoveragePass will also insert calls to +; SanitizerCoveragePass must split this critical edge in order to track +; coverage of this edge. SanitizerCoveragePass will also insert calls to ; @__sanitizer_cov_trace_pc using the debug location from the predecessor's ; branch. but, if the branch itself is missing debug info (say, by accident ; due to a bug in an earlier transform), we would fail a verifier check that