From fb99266401960afd99845890720b4d9b3ecd63d2 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Wed, 16 Mar 2022 15:23:25 -0700 Subject: [PATCH] [flang] Remove unused code and redundant assertion. Differential Revision: https://reviews.llvm.org/D121864 --- flang/include/flang/Lower/Bridge.h | 10 ++++------ flang/lib/Lower/Bridge.cpp | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/flang/include/flang/Lower/Bridge.h b/flang/include/flang/Lower/Bridge.h index 2965cf012134..d659581cab9f 100644 --- a/flang/include/flang/Lower/Bridge.h +++ b/flang/include/flang/Lower/Bridge.h @@ -64,10 +64,10 @@ public: //===--------------------------------------------------------------------===// mlir::MLIRContext &getMLIRContext() { return context; } - mlir::ModuleOp &getModule() { - assert(module && "This bridge is missing an MLIR module"); - return *module.get(); - } + + /// Get the ModuleOp. It can never be null, which is asserted in the ctor. + mlir::ModuleOp &getModule() { return *module.get(); } + const Fortran::common::IntrinsicTypeDefaultKinds &getDefaultKinds() const { return defaultKinds; } @@ -84,8 +84,6 @@ public: /// Create a folding context. Careful: this is very expensive. Fortran::evaluate::FoldingContext createFoldingContext() const; - bool validModule() { return (module != nullptr); } - //===--------------------------------------------------------------------===// // Perform the creation of an mlir::ModuleOp //===--------------------------------------------------------------------===// diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index aee742d2e4f7..3f354b7868a3 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -2454,6 +2454,6 @@ Fortran::lower::LoweringBridge::LoweringBridge( module = std::make_unique( mlir::ModuleOp::create(mlir::UnknownLoc::get(&context))); assert(module.get() && "module was not created"); - fir::setTargetTriple(*module.get(), triple); - fir::setKindMapping(*module.get(), kindMap); + fir::setTargetTriple(getModule(), triple); + fir::setKindMapping(getModule(), kindMap); }