2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/binary-ops.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of binary intrinsic operations to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine int_add(x, y, z)
integer :: x, y, z
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/c_ptr-constant-init.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test creation of outlined literal array with c_ptr/c_funptr elements.
! RUN: bbc -hlfir -emit-fir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine test
use, intrinsic :: iso_c_binding
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/calls-assumed-shape.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test lowering of calls involving assumed shape arrays or arrays with
! VALUE attribute.
! RUN: bbc -emit-fir -hlfir -polymorphic-type -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -polymorphic-type -o - %s | FileCheck %s

subroutine test_assumed_to_assumed(x)
interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! This is a special case because characters are always returned
! or handled in memory otherwise.

! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine scalar_char(c, i)
character(1) :: c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: bbc -emit-fir -hlfir --polymorphic-type -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir --polymorphic-type -o - %s | FileCheck %s

! Test when constant argument are copied in memory
! and passed to polymorphic arguments.
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

! Test that the constant array expression actual argument
! is placed into a temporary inside 'test' subroutine before
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/calls-f77.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of F77 calls to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! -----------------------------------------------------------------------------
! Test lowering of F77 procedure reference arguments
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/calls-optional.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! that is syntactically present, but may be absent at runtime (is
! an optional or a pointer/allocatable).
!
! RUN: bbc -emit-fir -hlfir -polymorphic-type -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -polymorphic-type -o - %s | FileCheck %s

subroutine optional_copy_in_out(x)
interface
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/concat.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of character concatenation to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine concat(c1, c2, c3)
character(*) :: c1, c2, c3
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/constant-derived.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of Constant<SomeDerived>.
! RUN: bbc -hlfir -emit-fir -o - -I nowhere %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - -I nowhere %s 2>&1 | FileCheck %s

subroutine test_constant_scalar()
type myderived
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/constant.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of Constant<T>.
! RUN: bbc -hlfir -emit-fir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! CHECK-LABEL: func.func @_QPtest_constant_scalar()
subroutine test_constant_scalar()
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/conversion-ops.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of intrinsic conversions to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine test
integer(4) :: i4
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/convert-variable.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of variables to fir.declare
! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck %s
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s

subroutine scalar_numeric(x)
integer :: x
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/descriptor-inquiries.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering of extent and lower bound inquires that
! come in lowering as evaluate::DescriptorInquiry.

! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine test_assumed_shape(x, r)
integer(8) :: r
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/designators-component-ref.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of component reference to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
module comp_ref
type t1
integer :: scalar_i
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/designators.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of designators to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine array_ref(x, n)
real :: x(:)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/dummy-argument-optional.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

! Test OPTIONAL lowering on caller/callee
module opt
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/elemental-array-ops.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of elemental intrinsic operations with array arguments to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine binary(x, y)
integer :: x(100), y(100)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/elemental-intrinsics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! The goal here is not to test every intrinsics, it is to test the
! lowering framework for elemental intrinsics. This test various
! intrinsics that have different number or arguments and argument types.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine simple_elemental(x,y)
real :: x(100), y(100)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test lowering of user defined elemental procedure reference to HLFIR
! With polymorphic arguments.
! RUN: bbc -emit-fir -hlfir -I nw -polymorphic-type -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -I nw -polymorphic-type -o - %s 2>&1 | FileCheck %s
module def_some_types
type :: t
integer :: i
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of user defined elemental procedure reference to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine by_addr(x, y)
integer :: x
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/expr-addr.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of of expressions as address
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! CHECK-LABEL: func.func @_QPfoo(
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<i32>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/expr-as-inquired.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering to HLFIR of the intrinsic lowering framework
! "asInquired" option.

! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine test_isAllocated(x, l)
logical :: l
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/expr-value.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of of expressions as values
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! CHECK-LABEL: func.func @_QPfoo()
subroutine foo()
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/function-return.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of function return to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

integer function simple_return()
simple_return = 42
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test passing mismatching rank arguments to unlimited polymorphic
! dummy with IGNORE_TKR(R).
! RUN: bbc -hlfir -emit-fir -polymorphic-type -o - -I nowhere %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -polymorphic-type -o - -I nowhere %s 2>&1 | FileCheck %s

module m
interface
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/implicit-call-mismatch.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! Lowering must close the eyes and do as if it did not know
! about the function definition since semantic lets these
! programs through with a warning.
! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck %s
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s

subroutine takes_char(c)
character(8) :: c
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/implicit-type-conversion.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck %s
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s

! CHECK-LABEL: func.func @_QPtest1(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "x"},
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/internal-procedures.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test captured variables instantiation inside internal procedures
! when lowering to HLFIR.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
subroutine test_explicit_shape_array(x, n)
integer(8) :: n
real :: x(n)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/intrinsic-assumed-type.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! arguments. These are a bit special because semantics do not represent
! assumed types actual arguments with an evaluate::Expr like for usual
! arguments.
! RUN: bbc -emit-fir -hlfir --polymorphic-type -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir --polymorphic-type -o - %s | FileCheck %s

subroutine assumed_type_to_intrinsic(a)
type(*) :: a(:)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! it only tests that the HFLIR procedure reference lowering
! infrastructure properly detects and dispatches intrinsic module
! procedure calls.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine foo(cptr, x)
use iso_c_binding, only : c_ptr, c_loc
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/intrinsic-subroutines.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering of intrinsic subroutines to HLFIR what matters here
! is not to test each subroutine, but to check how their
! lowering interfaces with the rest of lowering.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine test_subroutine(x)
real :: x
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/matmul.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of MATMUL intrinsic to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine matmul1(lhs, rhs, res)
integer :: lhs(:,:), rhs(:,:), res(:,:)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/null.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of NULL(MOLD) to HLFIR.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
subroutine test1(mold)
integer, pointer :: mold(:)
interface
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/parent-component-ref.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of parent component references to HLFIR.
! RUN: bbc -emit-fir -hlfir -polymorphic-type -o - %s -I nw | FileCheck %s
! RUN: bbc -emit-hlfir -polymorphic-type -o - %s -I nw | FileCheck %s

module pc_types
type t
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/procedure-designators.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of procedure designators to HLFIR.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

module test_proc_designator
interface
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/product.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of PRODUCT intrinsic to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! simple 1 argument PRODUCT
subroutine product1(a, s)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/statement-functions.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of statement functions to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine numeric_test(x)
integer :: x(:), i, stmt_func
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/structure-constructor.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of StructureConstructor.
! RUN: bbc -hlfir -emit-fir -o - -I nowhere %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - -I nowhere %s 2>&1 | FileCheck %s

module types
type t1
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/substrings.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering of substrings to HLFIR
! Note: cse is run to make the expected output more readable by sharing
! the boilerplate between the different susbtring cases.
! RUN: bbc -emit-fir -hlfir -o - %s | fir-opt -cse -o - | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | fir-opt -cse -o - | FileCheck %s

! CHECK-LABEL: func.func @_QPcst_len(
subroutine cst_len(array, scalar)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/sum.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of SUM intrinsic to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

! simple 1 argument SUM
subroutine sum1(a, s)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/transformational.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering of transformational intrinsic to HLFIR what matters here
! is not to test each transformational, but to check how their
! lowering interfaces with the rest of lowering.
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

subroutine test_transformational_implemented_with_runtime_allocation(x)
real :: x(10, 10)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/transpose.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of TRANSPOSE intrinsic to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine transpose1(m, res)
integer :: m(1,2), res(2, 1)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/unary-ops.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of unary intrinsic operations to HLFIR
! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s

subroutine parentheses_numeric_var(x)
integer :: x
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/vector-subscript-as-value.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test lowering of vector subscript designators outside of the
! assignment left-and side and input IO context.
! RUN: bbc -emit-fir -hlfir -o - -I nw %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - -I nw %s 2>&1 | FileCheck %s

subroutine foo(x, y)
integer :: x(100)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/vector-subscript-lhs.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Test lowering of vector subscripted designators in assignment
! left-hand sides.
! RUN: bbc -emit-fir -hlfir -o - -I nw %s 2>&1 | FileCheck %s
! RUN: bbc -emit-hlfir -o - -I nw %s 2>&1 | FileCheck %s

subroutine test_simple(x, vector)
integer(8) :: vector(10)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/where.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test lowering of WHERE construct and statements to HLFIR.
! RUN: bbc --hlfir -emit-fir -o - %s | FileCheck %s
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s

module where_defs
logical :: mask(10)
Expand Down
19 changes: 17 additions & 2 deletions flang/tools/bbc/bbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ static llvm::cl::opt<bool>
llvm::cl::desc("Dump the FIR created by lowering and exit"),
llvm::cl::init(false));

static llvm::cl::opt<bool>
emitHLFIR("emit-hlfir",
llvm::cl::desc("Dump the HLFIR created by lowering and exit"),
llvm::cl::init(false));

static llvm::cl::opt<bool> warnStdViolation("Mstandard",
llvm::cl::desc("emit warnings"),
llvm::cl::init(false));
Expand Down Expand Up @@ -274,7 +279,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
// Use default lowering options for bbc.
Fortran::lower::LoweringOptions loweringOptions{};
loweringOptions.setPolymorphicTypeImpl(enablePolymorphic);
loweringOptions.setLowerToHighLevelFIR(useHLFIR);
loweringOptions.setLowerToHighLevelFIR(useHLFIR || emitHLFIR);
auto burnside = Fortran::lower::LoweringBridge::create(
ctx, semanticsContext, defKinds, semanticsContext.intrinsics(),
semanticsContext.targetCharacteristics(), parsing.allCooked(), "",
Expand Down Expand Up @@ -311,14 +316,24 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
mlir::emitError(mlir::UnknownLoc::get(&ctx)) << msg;
return mlir::failure();
});
} else if (emitFIR) {
} else if (emitFIR || emitHLFIR) {
// --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
fir::createHLFIRToFIRPassPipeline(pm, llvm::OptimizationLevel::O2);
if (mlir::failed(pm.run(mlirModule))) {
llvm::errs() << "FATAL: lowering from HLFIR to FIR failed";
return mlir::failure();
}
}

printModule(mlirModule, out);
return mlir::success();
} else {
Expand Down