[flang-commits] [flang] fb99266 - [flang] Remove unused code and redundant assertion.

Eric Schweitz via flang-commits flang-commits at lists.llvm.org
Wed Mar 16 16:09:47 PDT 2022


Author: Eric Schweitz
Date: 2022-03-16T16:09:35-07:00
New Revision: fb99266401960afd99845890720b4d9b3ecd63d2

URL: https://github.com/llvm/llvm-project/commit/fb99266401960afd99845890720b4d9b3ecd63d2
DIFF: https://github.com/llvm/llvm-project/commit/fb99266401960afd99845890720b4d9b3ecd63d2.diff

LOG: [flang] Remove unused code and redundant assertion.

Differential Revision: https://reviews.llvm.org/D121864

Added: 
    

Modified: 
    flang/include/flang/Lower/Bridge.h
    flang/lib/Lower/Bridge.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Lower/Bridge.h b/flang/include/flang/Lower/Bridge.h
index 2965cf012134f..d659581cab9f2 100644
--- a/flang/include/flang/Lower/Bridge.h
+++ b/flang/include/flang/Lower/Bridge.h
@@ -64,10 +64,10 @@ class LoweringBridge {
   //===--------------------------------------------------------------------===//
 
   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 @@ class LoweringBridge {
   /// 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 aee742d2e4f71..3f354b7868a3b 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>(
       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);
 }


        


More information about the flang-commits mailing list