[flang-commits] [flang] [Flang][bbc] Prevent bbc -emit-fir command invoking all passes twice (PR #80927)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Feb 7 03:05:46 PST 2024


================
@@ -389,18 +389,14 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
     // --emit-fir: Build the IR, verify it, and dump the IR if the IR passes
     // verification. Use --dump-module-on-failure to dump invalid IR.
     pm.addPass(std::make_unique<Fortran::lower::VerifierPass>());
-    if (mlir::failed(pm.run(mlirModule))) {
-      llvm::errs() << "FATAL: verification of lowering to FIR failed";
-      return mlir::failure();
-    }
 
-    if (emitFIR && useHLFIR) {
-      // lower HLFIR to FIR
+    // Add HLFIR to FIR lowering pass
+    if (emitFIR && useHLFIR)
       fir::createHLFIRToFIRPassPipeline(pm, llvm::OptimizationLevel::O2);
-      if (mlir::failed(pm.run(mlirModule))) {
-        llvm::errs() << "FATAL: lowering from HLFIR to FIR failed";
-        return mlir::failure();
-      }
+
+    if (mlir::failed(pm.run(mlirModule))) {
+      llvm::errs() << "FATAL: verification of FIR or HLFIR module failed";
----------------
tblah wrote:

Please keep the old error message as that is likely to be more descriptive about what is going on here

https://github.com/llvm/llvm-project/pull/80927


More information about the flang-commits mailing list