Index: llvm/trunk/include/llvm/IR/SafepointIRVerifier.h =================================================================== --- llvm/trunk/include/llvm/IR/SafepointIRVerifier.h +++ llvm/trunk/include/llvm/IR/SafepointIRVerifier.h @@ -29,6 +29,16 @@ /// Create an instance of the safepoint verifier pass which can be added to /// a pass pipeline to check for relocation bugs. FunctionPass *createSafepointIRVerifierPass(); + +/// Create an instance of the safepoint verifier pass which can be added to +/// a pass pipeline to check for relocation bugs. +class SafepointIRVerifierPass : public PassInfoMixin { + +public: + explicit SafepointIRVerifierPass() {} + + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); +}; } #endif // LLVM_IR_SAFEPOINT_IR_VERIFIER Index: llvm/trunk/lib/IR/SafepointIRVerifier.cpp =================================================================== --- llvm/trunk/lib/IR/SafepointIRVerifier.cpp +++ llvm/trunk/lib/IR/SafepointIRVerifier.cpp @@ -197,6 +197,17 @@ static void Verify(const Function &F, const DominatorTree &DT, const CFGDeadness &CD); +namespace llvm { +PreservedAnalyses SafepointIRVerifierPass::run(Function &F, + FunctionAnalysisManager &AM) { + const auto &DT = AM.getResult(F); + CFGDeadness CD; + CD.processFunction(F, DT); + Verify(F, DT, CD); + return PreservedAnalyses::all(); +} +} + namespace { struct SafepointIRVerifier : public FunctionPass { Index: llvm/trunk/lib/Passes/PassBuilder.cpp =================================================================== --- llvm/trunk/lib/Passes/PassBuilder.cpp +++ llvm/trunk/lib/Passes/PassBuilder.cpp @@ -56,6 +56,7 @@ #include "llvm/IR/Dominators.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/PassManager.h" +#include "llvm/IR/SafepointIRVerifier.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormatVariadic.h" Index: llvm/trunk/lib/Passes/PassRegistry.def =================================================================== --- llvm/trunk/lib/Passes/PassRegistry.def +++ llvm/trunk/lib/Passes/PassRegistry.def @@ -231,6 +231,7 @@ FUNCTION_PASS("verify", LoopVerifierPass()) FUNCTION_PASS("verify", MemorySSAVerifierPass()) FUNCTION_PASS("verify", RegionInfoVerifierPass()) +FUNCTION_PASS("verify", SafepointIRVerifierPass()) FUNCTION_PASS("view-cfg", CFGViewerPass()) FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass()) FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())