[PATCH] D59825: SafepointIRVerifier port to new Pass Manager

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 20:28:15 PDT 2019


skatkov updated this revision to Diff 192405.
skatkov added a comment.

Fedor's comments handled.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59825/new/

https://reviews.llvm.org/D59825

Files:
  include/llvm/IR/SafepointIRVerifier.h
  lib/IR/SafepointIRVerifier.cpp
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def


Index: lib/Passes/PassRegistry.def
===================================================================
--- lib/Passes/PassRegistry.def
+++ lib/Passes/PassRegistry.def
@@ -231,6 +231,7 @@
 FUNCTION_PASS("verify<loops>", LoopVerifierPass())
 FUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
 FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
+FUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
 FUNCTION_PASS("view-cfg", CFGViewerPass())
 FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
 FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
Index: lib/Passes/PassBuilder.cpp
===================================================================
--- lib/Passes/PassBuilder.cpp
+++ 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: lib/IR/SafepointIRVerifier.cpp
===================================================================
--- lib/IR/SafepointIRVerifier.cpp
+++ 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<DominatorTreeAnalysis>(F);
+  CFGDeadness CD;
+  CD.processFunction(F, DT);
+  Verify(F, DT, CD);
+  return PreservedAnalyses::all();
+}
+}
+
 namespace {
 
 struct SafepointIRVerifier : public FunctionPass {
Index: include/llvm/IR/SafepointIRVerifier.h
===================================================================
--- include/llvm/IR/SafepointIRVerifier.h
+++ 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<SafepointIRVerifierPass> {
+
+public:
+  explicit SafepointIRVerifierPass() {}
+
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
 }
 
 #endif // LLVM_IR_SAFEPOINT_IR_VERIFIER


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59825.192405.patch
Type: text/x-patch
Size: 2510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190327/2d1e0680/attachment.bin>


More information about the llvm-commits mailing list