[clang] ef37504 - [Instrumentation] Remove legacy passes
Arthur Eubanks via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 25 13:14:17 PDT 2022
Author: Arthur Eubanks
Date: 2022-10-25T13:11:07-07:00
New Revision: ef37504879eecab1af98c70888bee0be403b9c60
URL: https://github.com/llvm/llvm-project/commit/ef37504879eecab1af98c70888bee0be403b9c60
DIFF: https://github.com/llvm/llvm-project/commit/ef37504879eecab1af98c70888bee0be403b9c60.diff
LOG: [Instrumentation] Remove legacy passes
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D136615
Added:
Modified:
clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
llvm/bindings/python/llvm/core.py
llvm/include/llvm-c/Initialization.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
llvm/tools/bugpoint/bugpoint.cpp
llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp b/clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
index 20cf98896e220..235ff150523e2 100644
--- a/clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
+++ b/clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp
@@ -49,7 +49,6 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
initializeAggressiveInstCombine(Registry);
- initializeInstrumentation(Registry);
initializeTarget(Registry);
CLArgs.push_back("-O2");
diff --git a/llvm/bindings/python/llvm/core.py b/llvm/bindings/python/llvm/core.py
index a9ec107faab71..4e99aac91182b 100644
--- a/llvm/bindings/python/llvm/core.py
+++ b/llvm/bindings/python/llvm/core.py
@@ -470,9 +470,6 @@ def register_library(library):
library.LLVMInitializeIPO.argtypes = [PassRegistry]
library.LLVMInitializeIPO.restype = None
- library.LLVMInitializeInstrumentation.argtypes = [PassRegistry]
- library.LLVMInitializeInstrumentation.restype = None
-
library.LLVMInitializeAnalysis.argtypes = [PassRegistry]
library.LLVMInitializeAnalysis.restype = None
@@ -626,7 +623,6 @@ def initialize_llvm():
lib.LLVMInitializeVectorization(p)
lib.LLVMInitializeInstCombine(p)
lib.LLVMInitializeIPO(p)
- lib.LLVMInitializeInstrumentation(p)
lib.LLVMInitializeAnalysis(p)
lib.LLVMInitializeCodeGen(p)
lib.LLVMInitializeTarget(p)
diff --git a/llvm/include/llvm-c/Initialization.h b/llvm/include/llvm-c/Initialization.h
index 2f3f0f890d786..c7770d911969a 100644
--- a/llvm/include/llvm-c/Initialization.h
+++ b/llvm/include/llvm-c/Initialization.h
@@ -37,7 +37,6 @@ void LLVMInitializeVectorization(LLVMPassRegistryRef R);
void LLVMInitializeInstCombine(LLVMPassRegistryRef R);
void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R);
void LLVMInitializeIPO(LLVMPassRegistryRef R);
-void LLVMInitializeInstrumentation(LLVMPassRegistryRef R);
void LLVMInitializeAnalysis(LLVMPassRegistryRef R);
void LLVMInitializeIPA(LLVMPassRegistryRef R);
void LLVMInitializeCodeGen(LLVMPassRegistryRef R);
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 55aaa09caf9af..6d389d432998f 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -39,9 +39,6 @@ void initializeAggressiveInstCombine(PassRegistry&);
/// Initialize all passes linked into the IPO library.
void initializeIPO(PassRegistry&);
-/// Initialize all passes linked into the Instrumentation library.
-void initializeInstrumentation(PassRegistry&);
-
/// Initialize all passes linked into the Analysis library.
void initializeAnalysis(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index a2cf1f06e88e9..b8c52620e9c99 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -80,7 +80,6 @@ namespace {
(void) llvm::createSCEVAAWrapperPass();
(void) llvm::createTypeBasedAAWrapperPass();
(void) llvm::createScopedNoAliasAAWrapperPass();
- (void) llvm::createBoundsCheckingLegacyPass();
(void) llvm::createBreakCriticalEdgesPass();
(void) llvm::createCallGraphDOTPrinterPass();
(void) llvm::createCallGraphViewerPass();
diff --git a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
index 5e68141e3399c..6c961c247cba1 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
@@ -22,10 +22,6 @@ struct BoundsCheckingPass : PassInfoMixin<BoundsCheckingPass> {
static bool isRequired() { return true; }
};
-
-/// Legacy pass creation function for the above pass.
-FunctionPass *createBoundsCheckingLegacyPass();
-
} // end namespace llvm
#endif // LLVM_TRANSFORMS_INSTRUMENTATION_BOUNDSCHECKING_H
diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
index 81ffa628c682a..8b1d39ad412fa 100644
--- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -222,35 +222,3 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager &
return PreservedAnalyses::none();
}
-
-namespace {
-struct BoundsCheckingLegacyPass : public FunctionPass {
- static char ID;
-
- BoundsCheckingLegacyPass() : FunctionPass(ID) {
- initializeBoundsCheckingLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override {
- auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
- auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
- return addBoundsChecking(F, TLI, SE);
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequired<TargetLibraryInfoWrapperPass>();
- AU.addRequired<ScalarEvolutionWrapperPass>();
- }
-};
-} // namespace
-
-char BoundsCheckingLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(BoundsCheckingLegacyPass, "bounds-checking",
- "Run-time bounds checking", false, false)
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
-INITIALIZE_PASS_END(BoundsCheckingLegacyPass, "bounds-checking",
- "Run-time bounds checking", false, false)
-
-FunctionPass *llvm::createBoundsCheckingLegacyPass() {
- return new BoundsCheckingLegacyPass();
-}
diff --git a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
index e5508f74103a2..ab72650ae801f 100644
--- a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -88,16 +88,3 @@ Comdat *llvm::getOrCreateFunctionComdat(Function &F, Triple &T) {
return C;
}
-/// initializeInstrumentation - Initialize all passes in the TransformUtils
-/// library.
-void llvm::initializeInstrumentation(PassRegistry &Registry) {
- initializeMemProfilerLegacyPassPass(Registry);
- initializeModuleMemProfilerLegacyPassPass(Registry);
- initializeBoundsCheckingLegacyPassPass(Registry);
-}
-
-/// LLVMInitializeInstrumentation - C binding for
-/// initializeInstrumentation.
-void LLVMInitializeInstrumentation(LLVMPassRegistryRef R) {
- initializeInstrumentation(*unwrap(R));
-}
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 47cc2cd3065cd..55acc36eaeb92 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -204,22 +204,6 @@ class MemProfiler {
Value *DynamicShadowOffset = nullptr;
};
-class MemProfilerLegacyPass : public FunctionPass {
-public:
- static char ID;
-
- explicit MemProfilerLegacyPass() : FunctionPass(ID) {
- initializeMemProfilerLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- StringRef getPassName() const override { return "MemProfilerFunctionPass"; }
-
- bool runOnFunction(Function &F) override {
- MemProfiler Profiler(*F.getParent());
- return Profiler.instrumentFunction(F);
- }
-};
-
class ModuleMemProfiler {
public:
ModuleMemProfiler(Module &M) { TargetTriple = Triple(M.getTargetTriple()); }
@@ -232,24 +216,6 @@ class ModuleMemProfiler {
Function *MemProfCtorFunction = nullptr;
};
-class ModuleMemProfilerLegacyPass : public ModulePass {
-public:
- static char ID;
-
- explicit ModuleMemProfilerLegacyPass() : ModulePass(ID) {
- initializeModuleMemProfilerLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- StringRef getPassName() const override { return "ModuleMemProfiler"; }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {}
-
- bool runOnModule(Module &M) override {
- ModuleMemProfiler MemProfiler(M);
- return MemProfiler.instrumentModule(M);
- }
-};
-
} // end anonymous namespace
MemProfilerPass::MemProfilerPass() = default;
@@ -273,30 +239,6 @@ PreservedAnalyses ModuleMemProfilerPass::run(Module &M,
return PreservedAnalyses::all();
}
-char MemProfilerLegacyPass::ID = 0;
-
-INITIALIZE_PASS_BEGIN(MemProfilerLegacyPass, "memprof",
- "MemProfiler: profile memory allocations and accesses.",
- false, false)
-INITIALIZE_PASS_END(MemProfilerLegacyPass, "memprof",
- "MemProfiler: profile memory allocations and accesses.",
- false, false)
-
-FunctionPass *llvm::createMemProfilerFunctionPass() {
- return new MemProfilerLegacyPass();
-}
-
-char ModuleMemProfilerLegacyPass::ID = 0;
-
-INITIALIZE_PASS(ModuleMemProfilerLegacyPass, "memprof-module",
- "MemProfiler: profile memory allocations and accesses."
- "ModulePass",
- false, false)
-
-ModulePass *llvm::createModuleMemProfilerLegacyPassPass() {
- return new ModuleMemProfilerLegacyPass();
-}
-
Value *MemProfiler::memToShadow(Value *Shadow, IRBuilder<> &IRB) {
// (Shadow & mask) >> scale
Shadow = IRB.CreateAnd(Shadow, Mapping.Mask);
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index 1701b16bd0157..9062930fe65fb 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -149,7 +149,6 @@ int main(int argc, char **argv) {
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
initializeAggressiveInstCombine(Registry);
- initializeInstrumentation(Registry);
initializeTarget(Registry);
if (std::getenv("bar") == (char*) -1) {
diff --git a/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp b/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
index 8657d894b00ce..fc9ea00cc2c45 100644
--- a/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
+++ b/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
@@ -198,7 +198,6 @@ extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
initializeAggressiveInstCombine(Registry);
- initializeInstrumentation(Registry);
initializeTarget(Registry);
// Parse input options
More information about the cfe-commits
mailing list