[llvm] 39e23bb - [LegacyPM] Remove HWAsanSanitizerLegacyPass
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 10:21:30 PDT 2022
Author: Fangrui Song
Date: 2022-04-25T10:21:26-07:00
New Revision: 39e23bb059d197a72b67255959777cf7d6ede9eb
URL: https://github.com/llvm/llvm-project/commit/39e23bb059d197a72b67255959777cf7d6ede9eb
DIFF: https://github.com/llvm/llvm-project/commit/39e23bb059d197a72b67255959777cf7d6ede9eb.diff
LOG: [LegacyPM] Remove HWAsanSanitizerLegacyPass
Using the legacy PM for the optimization pipeline was deprecated in 13.0.0.
Following recent changes to remove non-core features of the legacy
PM/optimization pipeline, remove AddressSanitizerLegacyPass...
...,
ModuleAddressSanitizerLegacyPass, and ASanGlobalsMetadataWrapperPass.
MemorySanitizerLegacyPass was removed in D123894.
AddressSanitizerLegacyPass was removed in D124216.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D124337
Added:
Modified:
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index cc286affac7db..573ca6bd90c6f 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -182,7 +182,6 @@ void initializeHardwareLoopsPass(PassRegistry&);
void initializeMIRProfileLoaderPassPass(PassRegistry &);
void initializeMemProfilerLegacyPassPass(PassRegistry &);
void initializeHotColdSplittingLegacyPassPass(PassRegistry&);
-void initializeHWAddressSanitizerLegacyPassPass(PassRegistry &);
void initializeIPSCCPLegacyPassPass(PassRegistry&);
void initializeIRCELegacyPassPass(PassRegistry&);
void initializeIROutlinerLegacyPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h b/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
index 6a6114ac11bc4..d3b5b5ca5c253 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
@@ -50,11 +50,6 @@ class HWAddressSanitizerPass : public PassInfoMixin<HWAddressSanitizerPass> {
HWAddressSanitizerOptions Options;
};
-FunctionPass *
-createHWAddressSanitizerLegacyPassPass(bool CompileKernel = false,
- bool Recover = false,
- bool DisableOptimization = false);
-
namespace HWASanAccessInfo {
// Bit field positions for the accessinfo parameter to
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 3b40f78de48b3..c9f1e78ed8282 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -389,93 +389,8 @@ class HWAddressSanitizer {
GlobalValue *ThreadPtrGlobal = nullptr;
};
-class HWAddressSanitizerLegacyPass : public FunctionPass {
-public:
- // Pass identification, replacement for typeid.
- static char ID;
-
- explicit HWAddressSanitizerLegacyPass(bool CompileKernel = false,
- bool Recover = false,
- bool DisableOptimization = false)
- : FunctionPass(ID), CompileKernel(CompileKernel), Recover(Recover),
- DisableOptimization(DisableOptimization) {
- initializeHWAddressSanitizerLegacyPassPass(
- *PassRegistry::getPassRegistry());
- }
-
- StringRef getPassName() const override { return "HWAddressSanitizer"; }
-
- bool doInitialization(Module &M) override {
- HWASan = std::make_unique<HWAddressSanitizer>(M, CompileKernel, Recover,
- /*SSI=*/nullptr);
- return true;
- }
-
- bool runOnFunction(Function &F) override {
- auto TargetTriple = Triple(F.getParent()->getTargetTriple());
- if (shouldUseStackSafetyAnalysis(TargetTriple, DisableOptimization)) {
- // We cannot call getAnalysis in doInitialization, that would cause a
- // crash as the required analyses are not initialized yet.
- HWASan->setSSI(
- &getAnalysis<StackSafetyGlobalInfoWrapperPass>().getResult());
- }
- return HWASan->sanitizeFunction(
- F,
- [&]() -> const DominatorTree & {
- return getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- },
- [&]() -> const PostDominatorTree & {
- return getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
- });
- }
-
- bool doFinalization(Module &M) override {
- HWASan.reset();
- return false;
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- // This is an over-estimation of, in case we are building for an
- // architecture that doesn't allow stack tagging we will still load the
- // analysis.
- // This is so we don't need to plumb TargetTriple all the way to here.
- if (mightUseStackSafetyAnalysis(DisableOptimization))
- AU.addRequired<StackSafetyGlobalInfoWrapperPass>();
- AU.addRequired<DominatorTreeWrapperPass>();
- AU.addRequired<PostDominatorTreeWrapperPass>();
- }
-
-private:
- std::unique_ptr<HWAddressSanitizer> HWASan;
- bool CompileKernel;
- bool Recover;
- bool DisableOptimization;
-};
-
} // end anonymous namespace
-char HWAddressSanitizerLegacyPass::ID = 0;
-
-INITIALIZE_PASS_BEGIN(
- HWAddressSanitizerLegacyPass, "hwasan",
- "HWAddressSanitizer: detect memory bugs using tagged addressing.", false,
- false)
-INITIALIZE_PASS_DEPENDENCY(StackSafetyGlobalInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
-INITIALIZE_PASS_END(
- HWAddressSanitizerLegacyPass, "hwasan",
- "HWAddressSanitizer: detect memory bugs using tagged addressing.", false,
- false)
-
-FunctionPass *
-llvm::createHWAddressSanitizerLegacyPassPass(bool CompileKernel, bool Recover,
- bool DisableOptimization) {
- assert(!CompileKernel || Recover);
- return new HWAddressSanitizerLegacyPass(CompileKernel, Recover,
- DisableOptimization);
-}
-
PreservedAnalyses HWAddressSanitizerPass::run(Module &M,
ModuleAnalysisManager &MAM) {
const StackSafetyGlobalInfo *SSI = nullptr;
diff --git a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
index 83bd2e0771e03..7bf979932a886 100644
--- a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -98,7 +98,6 @@ void llvm::initializeInstrumentation(PassRegistry &Registry) {
initializeCGProfileLegacyPassPass(Registry);
initializeInstrOrderFileLegacyPassPass(Registry);
initializeInstrProfilingLegacyPassPass(Registry);
- initializeHWAddressSanitizerLegacyPassPass(Registry);
initializeThreadSanitizerLegacyPassPass(Registry);
initializeModuleSanitizerCoverageLegacyPassPass(Registry);
initializeDataFlowSanitizerLegacyPassPass(Registry);
More information about the llvm-commits
mailing list