diff --git a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h --- a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h +++ b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @@ -98,26 +98,6 @@ AsanDetectStackUseAfterReturnMode::Runtime; }; -/// Public interface to the address sanitizer pass for instrumenting code to -/// check for various memory errors at runtime. -/// -/// The sanitizer itself is a function pass that works by inserting various -/// calls to the ASan runtime library functions. The runtime library essentially -/// replaces malloc() and free() with custom implementations that allow regions -/// surrounding requested memory to be checked for invalid accesses. -class AddressSanitizerPass : public PassInfoMixin { -public: - AddressSanitizerPass(const AddressSanitizerOptions &Options) - : Options(Options){}; - PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); - void printPipeline(raw_ostream &OS, - function_ref MapClassName2PassName); - static bool isRequired() { return true; } - -private: - AddressSanitizerOptions Options; -}; - /// Public interface to the address sanitizer module pass for instrumenting code /// to check for various memory errors. /// diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -402,13 +402,6 @@ "no-profile-peeling;profile-peeling;" "no-runtime;runtime;" "no-upperbound;upperbound") -FUNCTION_PASS_WITH_PARAMS("asan", - "AddressSanitizerPass", - [](AddressSanitizerOptions Opts) { - return AddressSanitizerPass(Opts); - }, - parseASanPassOptions, - "kernel") FUNCTION_PASS_WITH_PARAMS("msan", "MemorySanitizerPass", [](MemorySanitizerOptions Opts) { diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1271,36 +1271,6 @@ return GlobalsMetadata(M); } -PreservedAnalyses AddressSanitizerPass::run(Function &F, - AnalysisManager &AM) { - auto &MAMProxy = AM.getResult(F); - Module &M = *F.getParent(); - if (auto *R = MAMProxy.getCachedResult(M)) { - const TargetLibraryInfo *TLI = &AM.getResult(F); - AddressSanitizer Sanitizer(M, R, nullptr, Options.CompileKernel, - Options.Recover, Options.UseAfterScope, - Options.UseAfterReturn); - if (Sanitizer.instrumentFunction(F, TLI)) - return PreservedAnalyses::none(); - return PreservedAnalyses::all(); - } - - report_fatal_error( - "The ASanGlobalsMetadataAnalysis is required to run before " - "AddressSanitizer can run"); - return PreservedAnalyses::all(); -} - -void AddressSanitizerPass::printPipeline( - raw_ostream &OS, function_ref MapClassName2PassName) { - static_cast *>(this)->printPipeline( - OS, MapClassName2PassName); - OS << "<"; - if (Options.CompileKernel) - OS << "kernel"; - OS << ">"; -} - void ModuleAddressSanitizerPass::printPipeline( raw_ostream &OS, function_ref MapClassName2PassName) { static_cast *>(this)->printPipeline( diff --git a/llvm/test/DebugInfo/Generic/block-asan.ll b/llvm/test/DebugInfo/Generic/block-asan.ll --- a/llvm/test/DebugInfo/Generic/block-asan.ll +++ b/llvm/test/DebugInfo/Generic/block-asan.ll @@ -1,5 +1,5 @@ ; RUN: opt -S -asan -enable-new-pm=0 %s | FileCheck %s -; RUN: opt -S -passes=asan-function-pipeline %s | FileCheck %s +; RUN: opt -S -passes=asan-pipeline %s | FileCheck %s ; The IR of this testcase is generated from the following C code: ; void bar (int); diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cpuid.ll b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cpuid.ll --- a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cpuid.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cpuid.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S -o %t.ll +; RUN: opt < %s -passes='asan-pipeline' -S -o %t.ll ; RUN: FileCheck %s < %t.ll ; RUN: llc < %t.ll | FileCheck %s --check-prefix=ASM diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_more_registers_than_available.ll b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_more_registers_than_available.ll --- a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_more_registers_than_available.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_more_registers_than_available.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S -o %t.ll +; RUN: opt < %s -passes='asan-pipeline' -S -o %t.ll ; RUN: FileCheck %s < %t.ll ; Don't do stack malloc on functions containing inline assembly on 64-bit diff --git a/llvm/test/Instrumentation/AddressSanitizer/alloca-offset-lifetime.ll b/llvm/test/Instrumentation/AddressSanitizer/alloca-offset-lifetime.ll --- a/llvm/test/Instrumentation/AddressSanitizer/alloca-offset-lifetime.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/alloca-offset-lifetime.ll @@ -1,6 +1,6 @@ ; Test that ASAN will not instrument lifetime markers on alloca offsets. ; -; RUN: opt < %s -passes=asan-function-pipeline --asan-use-after-scope -S | FileCheck %s +; RUN: opt < %s -passes=asan-pipeline --asan-use-after-scope -S | FileCheck %s target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.15.0" diff --git a/llvm/test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll b/llvm/test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll --- a/llvm/test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/asan-detect-invalid-pointer-pair.ll @@ -1,8 +1,8 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -asan-detect-invalid-pointer-cmp -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-detect-invalid-pointer-cmp -S \ ; RUN: | FileCheck %s --check-prefixes=CMP,NOSUB,ALL -; RUN: opt < %s -passes='asan-function-pipeline' -asan-detect-invalid-pointer-sub -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-detect-invalid-pointer-sub -S \ ; RUN: | FileCheck %s --check-prefixes=SUB,NOCMP,ALL -; RUN: opt < %s -passes='asan-function-pipeline' -asan-detect-invalid-pointer-pair -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-detect-invalid-pointer-pair -S \ ; RUN: | FileCheck %s --check-prefixes=CMP,SUB,ALL ; Support instrumentation of invalid pointer pair detection. diff --git a/llvm/test/Instrumentation/AddressSanitizer/asan-masked-load-store.ll b/llvm/test/Instrumentation/AddressSanitizer/asan-masked-load-store.ll --- a/llvm/test/Instrumentation/AddressSanitizer/asan-masked-load-store.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/asan-masked-load-store.ll @@ -1,10 +1,10 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -asan-instrumentation-with-call-threshold=0 -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-instrumentation-with-call-threshold=0 -S \ ; RUN: | FileCheck %s -check-prefix=LOAD -check-prefix=STORE -check-prefix=ALL -; RUN: opt < %s -passes='asan-function-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-reads=0 -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-reads=0 -S \ ; RUN: | FileCheck %s -check-prefix=NOLOAD -check-prefix=STORE -check-prefix=ALL -; RUN: opt < %s -passes='asan-function-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-writes=0 -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-writes=0 -S \ ; RUN: | FileCheck %s -check-prefix=LOAD -check-prefix=NOSTORE -check-prefix=ALL -; RUN: opt < %s -passes='asan-function-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-reads=0 -asan-instrument-writes=0 -S \ +; RUN: opt < %s -passes='asan-pipeline' -asan-instrumentation-with-call-threshold=0 -asan-instrument-reads=0 -asan-instrument-writes=0 -S \ ; RUN: | FileCheck %s -check-prefix=NOLOAD -check-prefix=NOSTORE -check-prefix=ALL ; Support ASan instrumentation for constant-mask llvm.masked.{load,store} diff --git a/llvm/test/Instrumentation/AddressSanitizer/asan_address_space_attr.ll b/llvm/test/Instrumentation/AddressSanitizer/asan_address_space_attr.ll --- a/llvm/test/Instrumentation/AddressSanitizer/asan_address_space_attr.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/asan_address_space_attr.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.11.0" diff --git a/llvm/test/Instrumentation/AddressSanitizer/byref-args.ll b/llvm/test/Instrumentation/AddressSanitizer/byref-args.ll --- a/llvm/test/Instrumentation/AddressSanitizer/byref-args.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/byref-args.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s ; Test that for call instructions, the byref arguments are not ; instrumented, as no copy is implied. diff --git a/llvm/test/Instrumentation/AddressSanitizer/byval-args.ll b/llvm/test/Instrumentation/AddressSanitizer/byval-args.ll --- a/llvm/test/Instrumentation/AddressSanitizer/byval-args.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/byval-args.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s ; Test that for call instructions, the by-value arguments are instrumented. target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" diff --git a/llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll b/llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll --- a/llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes='asan-function-pipeline' -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s ; AddressSanitizer must insert __asan_handle_no_return ; before noreturn calls that aren't inserted by sanitizers. diff --git a/llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll b/llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll --- a/llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -passes='asan-function-pipeline' -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s +; RUN: opt -S -passes='asan-pipeline' -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s ; Generated from: ; int bar(int y) { ; return y + 2; diff --git a/llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll b/llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll --- a/llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll @@ -1,8 +1,8 @@ ; This check verifies that arguments passed by value get redzones. -; RUN: opt < %s -passes='asan-function-pipeline' -asan-realign-stack=32 -S | FileCheck %s -; RUN: opt < %s -passes='asan-function-pipeline' -asan-realign-stack=32 -asan-force-dynamic-shadow -S | FileCheck %s -; RUN: opt < %s -passes='asan-function-pipeline' -asan-realign-stack=32 -asan-mapping-scale=5 -S | FileCheck %s -; RUN: opt < %s -passes='asan-function-pipeline' -asan-realign-stack=32 -asan-force-dynamic-shadow -asan-mapping-scale=5 -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -asan-realign-stack=32 -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -asan-realign-stack=32 -asan-force-dynamic-shadow -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -asan-realign-stack=32 -asan-mapping-scale=5 -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -asan-realign-stack=32 -asan-force-dynamic-shadow -asan-mapping-scale=5 -S | FileCheck %s 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" diff --git a/llvm/test/Instrumentation/AddressSanitizer/str-nobuiltin.ll b/llvm/test/Instrumentation/AddressSanitizer/str-nobuiltin.ll --- a/llvm/test/Instrumentation/AddressSanitizer/str-nobuiltin.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/str-nobuiltin.ll @@ -1,6 +1,6 @@ ; Test marking string functions as nobuiltin in address sanitizer. ; -; RUN: opt < %s -passes='asan-function-pipeline' -S | FileCheck %s +; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s 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" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Instrumentation/AddressSanitizer/twice.ll b/llvm/test/Instrumentation/AddressSanitizer/twice.ll --- a/llvm/test/Instrumentation/AddressSanitizer/twice.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/twice.ll @@ -1,5 +1,5 @@ ; Check that the address sanitizer pass can be reused -; RUN: opt < %s -S -run-twice -passes='asan-function-pipeline' +; RUN: opt < %s -S -run-twice -passes='asan-pipeline' define void @foo(i64* %b) nounwind uwtable sanitize_address { entry: diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/kernel-inline.ll b/llvm/test/Instrumentation/HWAddressSanitizer/kernel-inline.ll --- a/llvm/test/Instrumentation/HWAddressSanitizer/kernel-inline.ll +++ b/llvm/test/Instrumentation/HWAddressSanitizer/kernel-inline.ll @@ -1,7 +1,7 @@ ; Test kernel inline hwasan instrumentation. -; RUN: opt < %s -passes=asan-function-pipeline -asan-kernel=1 -asan-recover=1 -asan-instrumentation-with-call-threshold=10000 -S | FileCheck --check-prefixes=CHECK-INLINE %s -; RUN: opt < %s -passes=asan-function-pipeline -asan-kernel=1 -asan-recover=1 -asan-instrumentation-with-call-threshold=0 -S | FileCheck --check-prefixes=CHECK-CALLBACK %s +; RUN: opt < %s -passes=asan-pipeline -asan-kernel=1 -asan-recover=1 -asan-instrumentation-with-call-threshold=10000 -S | FileCheck --check-prefixes=CHECK-INLINE %s +; RUN: opt < %s -passes=asan-pipeline -asan-kernel=1 -asan-recover=1 -asan-instrumentation-with-call-threshold=0 -S | FileCheck --check-prefixes=CHECK-CALLBACK %s 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" target triple = "x86_64-unknown-linux-gnu" diff --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll --- a/llvm/test/Other/new-pm-print-pipeline.ll +++ b/llvm/test/Other/new-pm-print-pipeline.ll @@ -46,9 +46,6 @@ ; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(hwasan<>,hwasan)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-14 ; CHECK-14: hwasan<>,hwasan -; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(asan<>,asan)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-15 -; CHECK-15: function(asan<>,asan) - ; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(loop-extract<>,loop-extract)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-16 ; CHECK-16: loop-extract<>,loop-extract diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -362,12 +362,6 @@ RequireAnalysisPass()); MPM.addPass(ModuleAddressSanitizerPass(Opts)); return true; - } else if (Name == "asan-function-pipeline") { - MPM.addPass( - RequireAnalysisPass()); - MPM.addPass( - createModuleToFunctionPassAdaptor(AddressSanitizerPass(Opts))); - return true; } return false; });