[PATCH] D134802: [llvm-stress] Remove dependency to legacy pass manager

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 10:47:33 PDT 2022


bjope updated this revision to Diff 463619.
bjope added a comment.

Now using M->print() directly to output the IR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134802

Files:
  llvm/tools/llvm-stress/llvm-stress.cpp


Index: llvm/tools/llvm-stress/llvm-stress.cpp
===================================================================
--- llvm/tools/llvm-stress/llvm-stress.cpp
+++ llvm/tools/llvm-stress/llvm-stress.cpp
@@ -24,17 +24,14 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalValue.h"
-#include "llvm/IR/IRPrintingPasses.h"
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
 #include "llvm/IR/Verifier.h"
-#include "llvm/Pass.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -761,10 +758,13 @@
     return 1;
   }
 
-  legacy::PassManager Passes;
-  Passes.add(createVerifierPass());
-  Passes.add(createPrintModulePass(Out->os()));
-  Passes.run(*M.get());
+  // Check that the generated module is accepted by the verifier.
+  if (verifyModule(*M.get(), &Out->os()))
+    report_fatal_error("Broken module found, compilation aborted!");
+
+  // Output textual IR.
+  M->print(Out->os(), nullptr);
+
   Out->keep();
 
   return 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134802.463619.patch
Type: text/x-patch
Size: 1248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220928/e4f5d793/attachment.bin>


More information about the llvm-commits mailing list