[flang-commits] [flang] 81ea6b7 - [flang][hlfir] Separate -emit-fir and -emit-hlfir for bbc

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu Jun 1 12:40:36 PDT 2023


Author: Tom Eccles
Date: 2023-06-01T19:37:47Z
New Revision: 81ea6b7e4b6c374c026dcf1ce742db36de2e56d4

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

LOG: [flang][hlfir] Separate -emit-fir and -emit-hlfir for bbc

In review for https://reviews.llvm.org/D146278, @vzakhari asked to
separate -emit-fir and -emit-hlfir. This will allow FIR to be easily
outputted after the HLFIR passes have been run.

The new semantics are as follows:

| Action      | -hlfir? | Result                          |
| =========== | ======= | =============================== |
| -emit-hlfir | N       | Outputs HLFIR                   |
| -emit-hlfir | Y       | Outputs HLFIR                   |
| -emit-fir   | N       | Outputs FIR, using old lowering |
| -emit-fir   | Y       | Outputs FIR, lowering via HLFIR |

This is tested in flang/test/HLFIR/hlfir-flags.f90

Depends on: D151088

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

Added: 
    flang/test/HLFIR/hlfir-flags.f90

Modified: 
    flang/test/HLFIR/boxchar_emboxing.f90
    flang/test/HLFIR/c_ptr_byvalue.f90
    flang/test/HLFIR/call_with_poly_dummy.f90
    flang/test/HLFIR/extents-of-shape-of.f90
    flang/test/HLFIR/mul_transpose.f90
    flang/test/HLFIR/optional_dummy.f90
    flang/test/Lower/HLFIR/all.f90
    flang/test/Lower/HLFIR/allocatable-and-pointer-components.f90
    flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90
    flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90
    flang/test/Lower/HLFIR/allocatables-and-pointers.f90
    flang/test/Lower/HLFIR/any.f90
    flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90
    flang/test/Lower/HLFIR/array-ctor-as-elemental.f90
    flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90
    flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90
    flang/test/Lower/HLFIR/array-ctor-character.f90
    flang/test/Lower/HLFIR/array-ctor-derived.f90
    flang/test/Lower/HLFIR/array-ctor-index.f90
    flang/test/Lower/HLFIR/assignment-intrinsics.f90
    flang/test/Lower/HLFIR/associate-construct.f90
    flang/test/Lower/HLFIR/binary-ops.f90
    flang/test/Lower/HLFIR/c_ptr-constant-init.f90
    flang/test/Lower/HLFIR/calls-assumed-shape.f90
    flang/test/Lower/HLFIR/calls-character-singleton-result.f90
    flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90
    flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
    flang/test/Lower/HLFIR/calls-f77.f90
    flang/test/Lower/HLFIR/calls-optional.f90
    flang/test/Lower/HLFIR/concat.f90
    flang/test/Lower/HLFIR/constant-derived.f90
    flang/test/Lower/HLFIR/constant.f90
    flang/test/Lower/HLFIR/conversion-ops.f90
    flang/test/Lower/HLFIR/convert-variable.f90
    flang/test/Lower/HLFIR/descriptor-inquiries.f90
    flang/test/Lower/HLFIR/designators-component-ref.f90
    flang/test/Lower/HLFIR/designators.f90
    flang/test/Lower/HLFIR/dummy-argument-optional.f90
    flang/test/Lower/HLFIR/elemental-array-ops.f90
    flang/test/Lower/HLFIR/elemental-intrinsics.f90
    flang/test/Lower/HLFIR/elemental-user-procedure-ref-polymorphic.f90
    flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
    flang/test/Lower/HLFIR/expr-addr.f90
    flang/test/Lower/HLFIR/expr-as-inquired.f90
    flang/test/Lower/HLFIR/expr-value.f90
    flang/test/Lower/HLFIR/function-return.f90
    flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90
    flang/test/Lower/HLFIR/implicit-call-mismatch.f90
    flang/test/Lower/HLFIR/implicit-type-conversion.f90
    flang/test/Lower/HLFIR/internal-procedures.f90
    flang/test/Lower/HLFIR/intrinsic-assumed-type.f90
    flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
    flang/test/Lower/HLFIR/intrinsic-subroutines.f90
    flang/test/Lower/HLFIR/matmul.f90
    flang/test/Lower/HLFIR/null.f90
    flang/test/Lower/HLFIR/parent-component-ref.f90
    flang/test/Lower/HLFIR/procedure-designators.f90
    flang/test/Lower/HLFIR/product.f90
    flang/test/Lower/HLFIR/statement-functions.f90
    flang/test/Lower/HLFIR/structure-constructor.f90
    flang/test/Lower/HLFIR/substrings.f90
    flang/test/Lower/HLFIR/sum.f90
    flang/test/Lower/HLFIR/transformational.f90
    flang/test/Lower/HLFIR/transpose.f90
    flang/test/Lower/HLFIR/unary-ops.f90
    flang/test/Lower/HLFIR/vector-subscript-as-value.f90
    flang/test/Lower/HLFIR/vector-subscript-lhs.f90
    flang/test/Lower/HLFIR/where.f90
    flang/tools/bbc/bbc.cpp

Removed: 
    flang/test/HLFIR/flang-experimental-hlfir-flag.f90


################################################################################
diff  --git a/flang/test/HLFIR/boxchar_emboxing.f90 b/flang/test/HLFIR/boxchar_emboxing.f90
index aec6a95fda965..3a7671668afaf 100644
--- a/flang/test/HLFIR/boxchar_emboxing.f90
+++ b/flang/test/HLFIR/boxchar_emboxing.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -polymorphic-type -emit-fir -hlfir %s -o - | FileCheck %s
+! RUN: bbc -polymorphic-type -emit-hlfir %s -o - | FileCheck %s
 
 ! CHECK-LABEL:   func.func @_QPtest1(
 ! CHECK-SAME:                        %[[VAL_0:.*]]: !fir.class<none> {fir.bindc_name = "x"}) {

diff  --git a/flang/test/HLFIR/c_ptr_byvalue.f90 b/flang/test/HLFIR/c_ptr_byvalue.f90
index 7c549335efcc1..45e17c0ff6309 100644
--- a/flang/test/HLFIR/c_ptr_byvalue.f90
+++ b/flang/test/HLFIR/c_ptr_byvalue.f90
@@ -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:           %[[VAL_110:.*]]:3 = hlfir.associate %{{.*}} {uniq_name = "adapt.cptrbyval"} : (!hlfir.expr<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) -> (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, i1)

diff  --git a/flang/test/HLFIR/call_with_poly_dummy.f90 b/flang/test/HLFIR/call_with_poly_dummy.f90
index 19776ba68ff06..2dc29f86fdf32 100644
--- a/flang/test/HLFIR/call_with_poly_dummy.f90
+++ b/flang/test/HLFIR/call_with_poly_dummy.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -polymorphic-type -emit-fir -hlfir %s -o - | FileCheck %s
+! RUN: bbc -polymorphic-type -emit-hlfir %s -o - | FileCheck %s
 
 ! Test passing arguments to subprograms with polymorphic dummy arguments.
 

diff  --git a/flang/test/HLFIR/extents-of-shape-of.f90 b/flang/test/HLFIR/extents-of-shape-of.f90
index 8fc7133985ffc..e9310ca175176 100644
--- a/flang/test/HLFIR/extents-of-shape-of.f90
+++ b/flang/test/HLFIR/extents-of-shape-of.f90
@@ -1,5 +1,5 @@
-! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck --check-prefix CHECK-ALL --check-prefix CHECK-HLFIR %s
-! RUN: bbc -emit-fir -hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | fir-opt --bufferize-hlfir | fir-opt --convert-hlfir-to-fir | FileCheck --check-prefix CHECK-ALL --check-prefix CHECK-FIR %s
+! RUN: bbc -emit-hlfir %s -o - | FileCheck --check-prefix CHECK-ALL --check-prefix CHECK-HLFIR %s
+! RUN: bbc -emit-hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | fir-opt --bufferize-hlfir | fir-opt --convert-hlfir-to-fir | FileCheck --check-prefix CHECK-ALL --check-prefix CHECK-FIR %s
 subroutine foo(a, b)
   real :: a(2, 2), b(:, :)
   interface

diff  --git a/flang/test/HLFIR/flang-experimental-hlfir-flag.f90 b/flang/test/HLFIR/hlfir-flags.f90
similarity index 54%
rename from flang/test/HLFIR/flang-experimental-hlfir-flag.f90
rename to flang/test/HLFIR/hlfir-flags.f90
index 76f40c8d8fc57..ccd6184e02652 100644
--- a/flang/test/HLFIR/flang-experimental-hlfir-flag.f90
+++ b/flang/test/HLFIR/hlfir-flags.f90
@@ -1,15 +1,19 @@
-! Test -flang-experimental-hlfir, -emit-hlfir, -emit-fir flags
+! Test -flang-experimental-hlfir (flang-new), -hlfir (bbc), -emit-hlfir, -emit-fir flags
 ! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
 ! RUN: %flang_fc1 -emit-hlfir -flang-experimental-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
+! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
 ! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
+! RUN: bbc -emit-fir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
 ! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
+! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
 
-! | Action      | -flang-experimental-hlfir? | Result                          |
-! | =========== | ========================== | =============================== |
-! | -emit-hlfir | N                          | Outputs HLFIR                   |
-! | -emit-hlfir | Y                          | Outputs HLFIR                   |
-! | -emit-fir   | N                          | Outputs FIR, using old lowering |
-! | -emit-fir   | Y                          | Outputs FIR, lowering via HLFIR |
+! | Action      | -flang-experimental-hlfir / -hlfir? | Result                          |
+! | =========== | =================================== | =============================== |
+! | -emit-hlfir | N                                   | Outputs HLFIR                   |
+! | -emit-hlfir | Y                                   | Outputs HLFIR                   |
+! | -emit-fir   | N                                   | Outputs FIR, using old lowering |
+! | -emit-fir   | Y                                   | Outputs FIR, lowering via HLFIR |
 
 subroutine test(a, res)
   real :: a(:), res

diff  --git a/flang/test/HLFIR/mul_transpose.f90 b/flang/test/HLFIR/mul_transpose.f90
index c79c742efc441..97fe3d87a2d0b 100644
--- a/flang/test/HLFIR/mul_transpose.f90
+++ b/flang/test/HLFIR/mul_transpose.f90
@@ -1,8 +1,8 @@
-! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck --check-prefix CHECK-BASE --check-prefix CHECK-ALL %s
-! RUN: bbc -emit-fir -hlfir %s -o - | fir-opt --canonicalize | FileCheck --check-prefix CHECK-CANONICAL --check-prefix CHECK-ALL %s
-! RUN: bbc -emit-fir -hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | FileCheck --check-prefix CHECK-LOWERING --check-prefix CHECK-ALL %s
-! RUN: bbc -emit-fir -hlfir %s -o - | fir-opt --canonicalize | fir-opt --lower-hlfir-intrinsics | FileCheck --check-prefix CHECK-LOWERING-OPT --check-prefix CHECK-ALL %s
-! RUN: bbc -emit-fir -hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | fir-opt --bufferize-hlfir | FileCheck --check-prefix CHECK-BUFFERING --check-prefix CHECK-ALL %s
+! RUN: bbc -emit-hlfir %s -o - | FileCheck --check-prefix CHECK-BASE --check-prefix CHECK-ALL %s
+! RUN: bbc -emit-hlfir %s -o - | fir-opt --canonicalize | FileCheck --check-prefix CHECK-CANONICAL --check-prefix CHECK-ALL %s
+! RUN: bbc -emit-hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | FileCheck --check-prefix CHECK-LOWERING --check-prefix CHECK-ALL %s
+! RUN: bbc -emit-hlfir %s -o - | fir-opt --canonicalize | fir-opt --lower-hlfir-intrinsics | FileCheck --check-prefix CHECK-LOWERING-OPT --check-prefix CHECK-ALL %s
+! RUN: bbc -emit-hlfir %s -o - | fir-opt --lower-hlfir-intrinsics | fir-opt --bufferize-hlfir | FileCheck --check-prefix CHECK-BUFFERING --check-prefix CHECK-ALL %s
 
 ! Test passing a hlfir.expr from one intrinsic to another
 subroutine mul_transpose(a, b, res)

diff  --git a/flang/test/HLFIR/optional_dummy.f90 b/flang/test/HLFIR/optional_dummy.f90
index 9dd2076f82a1a..0f1a8d5b9c39d 100644
--- a/flang/test/HLFIR/optional_dummy.f90
+++ b/flang/test/HLFIR/optional_dummy.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir %s -o - | FileCheck %s
+! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
 
 ! Check that the lowering does not generate fir.box_addr for
 ! the optional box. It will cause segfault during execution.

diff  --git a/flang/test/Lower/HLFIR/all.f90 b/flang/test/Lower/HLFIR/all.f90
index 080039af9b12c..253a742cf16f9 100644
--- a/flang/test/Lower/HLFIR/all.f90
+++ b/flang/test/Lower/HLFIR/all.f90
@@ -1,5 +1,5 @@
 ! Test lowering of ALL 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 ALL
 subroutine all1(a, s)

diff  --git a/flang/test/Lower/HLFIR/allocatable-and-pointer-components.f90 b/flang/test/Lower/HLFIR/allocatable-and-pointer-components.f90
index c29b62aef251d..ff84cf29e8ac5 100644
--- a/flang/test/Lower/HLFIR/allocatable-and-pointer-components.f90
+++ b/flang/test/Lower/HLFIR/allocatable-and-pointer-components.f90
@@ -1,5 +1,5 @@
 ! Test lowering of whole allocatable and pointer components to HLFIR
-! RUN: bbc -emit-fir -hlfir -o - %s -I nw | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s -I nw | FileCheck %s
 
 module def_test_types
   type t1

diff  --git a/flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90 b/flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90
index 75062df2b8baf..f5ae6592faa4b 100644
--- a/flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90
+++ b/flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90
@@ -1,6 +1,6 @@
 ! Test lowering of allocate, deallocate and pointer assignment statements to
 ! HLFIR.
-! RUN: bbc -emit-fir -hlfir -o - %s -I nw | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s -I nw | FileCheck %s
 
 subroutine allocation(x)
   character(*), allocatable :: x(:)

diff  --git a/flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90 b/flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90
index fea2a5ef27af4..7ec620bb59cc4 100644
--- a/flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90
+++ b/flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90
@@ -3,7 +3,7 @@
 ! be inserted and addressed in a following hlfir.designate to address
 ! the sub-part.
 
-! RUN: bbc -emit-fir -hlfir -o - %s -I nw | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s -I nw | FileCheck %s
 
 module m
   type t1

diff  --git a/flang/test/Lower/HLFIR/allocatables-and-pointers.f90 b/flang/test/Lower/HLFIR/allocatables-and-pointers.f90
index e0685e04cc19f..9c54d5cd6bace 100644
--- a/flang/test/Lower/HLFIR/allocatables-and-pointers.f90
+++ b/flang/test/Lower/HLFIR/allocatables-and-pointers.f90
@@ -1,5 +1,5 @@
 ! Test lowering of whole allocatable and pointers to HLFIR
-! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s
 
 subroutine passing_allocatable(x)
   interface

diff  --git a/flang/test/Lower/HLFIR/any.f90 b/flang/test/Lower/HLFIR/any.f90
index ac2f9bae43ecf..521890b3c08ed 100644
--- a/flang/test/Lower/HLFIR/any.f90
+++ b/flang/test/Lower/HLFIR/any.f90
@@ -1,5 +1,5 @@
 ! Test lowering of ANY 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 ANY
 subroutine any1(a, s)
   logical :: a(:), s

diff  --git a/flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90 b/flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90
index 6cfdb20aa43ce..4b4192b1df930 100644
--- a/flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-as-elemental-nested.f90
@@ -1,5 +1,5 @@
 ! Test lowering of nested array constructors as hlfir.elemental.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 ! hlfir.end_associate and hlfir.destroy used to be generated
 ! after hlfir.yield_element for the outermost hlfir.elemental.

diff  --git a/flang/test/Lower/HLFIR/array-ctor-as-elemental.f90 b/flang/test/Lower/HLFIR/array-ctor-as-elemental.f90
index ff9ecf7ac70ff..77c7ef1a96b4d 100644
--- a/flang/test/Lower/HLFIR/array-ctor-as-elemental.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-as-elemental.f90
@@ -1,5 +1,5 @@
 ! Test lowering of array constructors as hlfir.elemental.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 subroutine test_as_simple_elemental(n)
   integer :: n

diff  --git a/flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90 b/flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90
index b3d8f80d75b39..23f958956877c 100644
--- a/flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90
@@ -1,5 +1,5 @@
 ! Test lowering of array constructors as inlined temporary.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 subroutine test_simple(i)
   call takes_int([42, i])

diff  --git a/flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90 b/flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90
index 26b68c3f2cb02..157dbceb04799 100644
--- a/flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90
@@ -1,5 +1,5 @@
 ! Test lowering of array constructors requiring runtime library help to HLFIR.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 module arrayctor
 contains
 

diff  --git a/flang/test/Lower/HLFIR/array-ctor-character.f90 b/flang/test/Lower/HLFIR/array-ctor-character.f90
index 92312dc7328a8..7304eb24a647f 100644
--- a/flang/test/Lower/HLFIR/array-ctor-character.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-character.f90
@@ -1,5 +1,5 @@
 ! Test lowering of character array constructors to HLFIR.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 module chararrayctor
   character(3), target :: ctarg1 = "abc"

diff  --git a/flang/test/Lower/HLFIR/array-ctor-derived.f90 b/flang/test/Lower/HLFIR/array-ctor-derived.f90
index d814083b59e4d..21a3eb78a1995 100644
--- a/flang/test/Lower/HLFIR/array-ctor-derived.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-derived.f90
@@ -1,5 +1,5 @@
 ! Test lowering of derived type array constructors to HLFIR.
-! RUN: bbc -emit-fir -hlfir --polymorphic-type -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir --polymorphic-type -o - %s | FileCheck %s
 
 module types
   type simple

diff  --git a/flang/test/Lower/HLFIR/array-ctor-index.f90 b/flang/test/Lower/HLFIR/array-ctor-index.f90
index b52a1afb68b2b..611fd07b32959 100644
--- a/flang/test/Lower/HLFIR/array-ctor-index.f90
+++ b/flang/test/Lower/HLFIR/array-ctor-index.f90
@@ -1,5 +1,5 @@
 ! Check that the implied-do index value is converted to proper type.
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 function test1(k)
   integer*1 :: k

diff  --git a/flang/test/Lower/HLFIR/assignment-intrinsics.f90 b/flang/test/Lower/HLFIR/assignment-intrinsics.f90
index 169e5fa4b7027..bf4430a8c6405 100644
--- a/flang/test/Lower/HLFIR/assignment-intrinsics.f90
+++ b/flang/test/Lower/HLFIR/assignment-intrinsics.f90
@@ -1,5 +1,5 @@
 ! Test lowering of intrinsic assignments to HLFIR
-! RUN: bbc -emit-fir -hlfir -o - %s 2>&1 | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s
 
 ! -----------------------------------------------------------------------------
 !     Test assignments with scalar variable LHS and RHS

diff  --git a/flang/test/Lower/HLFIR/associate-construct.f90 b/flang/test/Lower/HLFIR/associate-construct.f90
index be3ace28bf52e..4b493ec8c6bf7 100644
--- a/flang/test/Lower/HLFIR/associate-construct.f90
+++ b/flang/test/Lower/HLFIR/associate-construct.f90
@@ -1,5 +1,5 @@
 ! Test lowering of associate construct to HLFIR
-! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
 
 subroutine associate_expr(x)
   integer :: x(:)

diff  --git a/flang/test/Lower/HLFIR/binary-ops.f90 b/flang/test/Lower/HLFIR/binary-ops.f90
index 4b5b1a698e8c3..3809f0dda6df0 100644
--- a/flang/test/Lower/HLFIR/binary-ops.f90
+++ b/flang/test/Lower/HLFIR/binary-ops.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/c_ptr-constant-init.f90 b/flang/test/Lower/HLFIR/c_ptr-constant-init.f90
index 1d2d3d805076e..fcf2d1e31475d 100644
--- a/flang/test/Lower/HLFIR/c_ptr-constant-init.f90
+++ b/flang/test/Lower/HLFIR/c_ptr-constant-init.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/calls-assumed-shape.f90 b/flang/test/Lower/HLFIR/calls-assumed-shape.f90
index 9f395c34dee47..447da252d77bd 100644
--- a/flang/test/Lower/HLFIR/calls-assumed-shape.f90
+++ b/flang/test/Lower/HLFIR/calls-assumed-shape.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/calls-character-singleton-result.f90 b/flang/test/Lower/HLFIR/calls-character-singleton-result.f90
index 638a8078a949e..0ef8490f7b776 100644
--- a/flang/test/Lower/HLFIR/calls-character-singleton-result.f90
+++ b/flang/test/Lower/HLFIR/calls-character-singleton-result.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90 b/flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90
index f6986375fdc16..e1de5f765349f 100644
--- a/flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90
+++ b/flang/test/Lower/HLFIR/calls-constant-expr-arg-polymorphic.f90
@@ -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.

diff  --git a/flang/test/Lower/HLFIR/calls-constant-expr-arg.f90 b/flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
index 460035eb3d242..eea86275f88a0 100644
--- a/flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
+++ b/flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/calls-f77.f90 b/flang/test/Lower/HLFIR/calls-f77.f90
index f4d10616aad16..d736865a41beb 100644
--- a/flang/test/Lower/HLFIR/calls-f77.f90
+++ b/flang/test/Lower/HLFIR/calls-f77.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/calls-optional.f90 b/flang/test/Lower/HLFIR/calls-optional.f90
index 8990e2c4bff7a..b25ccbd39895e 100644
--- a/flang/test/Lower/HLFIR/calls-optional.f90
+++ b/flang/test/Lower/HLFIR/calls-optional.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/concat.f90 b/flang/test/Lower/HLFIR/concat.f90
index e746148c133dd..842b3181e5787 100644
--- a/flang/test/Lower/HLFIR/concat.f90
+++ b/flang/test/Lower/HLFIR/concat.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/constant-derived.f90 b/flang/test/Lower/HLFIR/constant-derived.f90
index 62d5079b57206..b813da33f3f6c 100644
--- a/flang/test/Lower/HLFIR/constant-derived.f90
+++ b/flang/test/Lower/HLFIR/constant-derived.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/constant.f90 b/flang/test/Lower/HLFIR/constant.f90
index fcde5aa3fca6d..4a88702591c65 100644
--- a/flang/test/Lower/HLFIR/constant.f90
+++ b/flang/test/Lower/HLFIR/constant.f90
@@ -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()

diff  --git a/flang/test/Lower/HLFIR/conversion-ops.f90 b/flang/test/Lower/HLFIR/conversion-ops.f90
index 230d74ea9a00e..d578ed1e393b3 100644
--- a/flang/test/Lower/HLFIR/conversion-ops.f90
+++ b/flang/test/Lower/HLFIR/conversion-ops.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/convert-variable.f90 b/flang/test/Lower/HLFIR/convert-variable.f90
index 1905241fc0274..746ac085ad115 100644
--- a/flang/test/Lower/HLFIR/convert-variable.f90
+++ b/flang/test/Lower/HLFIR/convert-variable.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/descriptor-inquiries.f90 b/flang/test/Lower/HLFIR/descriptor-inquiries.f90
index ecdec0ac8e507..b991bdc97a32e 100644
--- a/flang/test/Lower/HLFIR/descriptor-inquiries.f90
+++ b/flang/test/Lower/HLFIR/descriptor-inquiries.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/designators-component-ref.f90 b/flang/test/Lower/HLFIR/designators-component-ref.f90
index 7cd355d95ac24..ed0a53e185724 100644
--- a/flang/test/Lower/HLFIR/designators-component-ref.f90
+++ b/flang/test/Lower/HLFIR/designators-component-ref.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/designators.f90 b/flang/test/Lower/HLFIR/designators.f90
index 777d6ea5182e1..de1ec6e5b3cf1 100644
--- a/flang/test/Lower/HLFIR/designators.f90
+++ b/flang/test/Lower/HLFIR/designators.f90
@@ -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(:)

diff  --git a/flang/test/Lower/HLFIR/dummy-argument-optional.f90 b/flang/test/Lower/HLFIR/dummy-argument-optional.f90
index 32ab0e0f6a117..5bf73a37c559a 100644
--- a/flang/test/Lower/HLFIR/dummy-argument-optional.f90
+++ b/flang/test/Lower/HLFIR/dummy-argument-optional.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/elemental-array-ops.f90 b/flang/test/Lower/HLFIR/elemental-array-ops.f90
index 9a240438d110c..ff97a671e0fea 100644
--- a/flang/test/Lower/HLFIR/elemental-array-ops.f90
+++ b/flang/test/Lower/HLFIR/elemental-array-ops.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/elemental-intrinsics.f90 b/flang/test/Lower/HLFIR/elemental-intrinsics.f90
index d38e4a9d59c05..e188d06558f1c 100644
--- a/flang/test/Lower/HLFIR/elemental-intrinsics.f90
+++ b/flang/test/Lower/HLFIR/elemental-intrinsics.f90
@@ -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 
diff erent 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)

diff  --git a/flang/test/Lower/HLFIR/elemental-user-procedure-ref-polymorphic.f90 b/flang/test/Lower/HLFIR/elemental-user-procedure-ref-polymorphic.f90
index c9ff172705514..b4aca062cffd3 100644
--- a/flang/test/Lower/HLFIR/elemental-user-procedure-ref-polymorphic.f90
+++ b/flang/test/Lower/HLFIR/elemental-user-procedure-ref-polymorphic.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90 b/flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
index 400bdb5c77736..b22cedf13953c 100644
--- a/flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
+++ b/flang/test/Lower/HLFIR/elemental-user-procedure-ref.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/expr-addr.f90 b/flang/test/Lower/HLFIR/expr-addr.f90
index 3c69cdf88b383..036259d7b5d85 100644
--- a/flang/test/Lower/HLFIR/expr-addr.f90
+++ b/flang/test/Lower/HLFIR/expr-addr.f90
@@ -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>

diff  --git a/flang/test/Lower/HLFIR/expr-as-inquired.f90 b/flang/test/Lower/HLFIR/expr-as-inquired.f90
index 8543921ca242e..1186d08c9f3f9 100644
--- a/flang/test/Lower/HLFIR/expr-as-inquired.f90
+++ b/flang/test/Lower/HLFIR/expr-as-inquired.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/expr-value.f90 b/flang/test/Lower/HLFIR/expr-value.f90
index 2beb9749ad79c..bcb5f4deae29b 100644
--- a/flang/test/Lower/HLFIR/expr-value.f90
+++ b/flang/test/Lower/HLFIR/expr-value.f90
@@ -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()

diff  --git a/flang/test/Lower/HLFIR/function-return.f90 b/flang/test/Lower/HLFIR/function-return.f90
index a4ceed55d3354..42f66c3d03e14 100644
--- a/flang/test/Lower/HLFIR/function-return.f90
+++ b/flang/test/Lower/HLFIR/function-return.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90 b/flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90
index 4209cfdf66e39..b22d82bcd5c66 100644
--- a/flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90
+++ b/flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/implicit-call-mismatch.f90 b/flang/test/Lower/HLFIR/implicit-call-mismatch.f90
index 4c10b32fba189..835da013c70b3 100644
--- a/flang/test/Lower/HLFIR/implicit-call-mismatch.f90
+++ b/flang/test/Lower/HLFIR/implicit-call-mismatch.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/implicit-type-conversion.f90 b/flang/test/Lower/HLFIR/implicit-type-conversion.f90
index 66bf7f81f78de..07fc3aab0995c 100644
--- a/flang/test/Lower/HLFIR/implicit-type-conversion.f90
+++ b/flang/test/Lower/HLFIR/implicit-type-conversion.f90
@@ -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"},

diff  --git a/flang/test/Lower/HLFIR/internal-procedures.f90 b/flang/test/Lower/HLFIR/internal-procedures.f90
index ca3ec3e74289b..bbde78e71bf53 100644
--- a/flang/test/Lower/HLFIR/internal-procedures.f90
+++ b/flang/test/Lower/HLFIR/internal-procedures.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/intrinsic-assumed-type.f90 b/flang/test/Lower/HLFIR/intrinsic-assumed-type.f90
index c9c7c68960d9d..d0381344c8931 100644
--- a/flang/test/Lower/HLFIR/intrinsic-assumed-type.f90
+++ b/flang/test/Lower/HLFIR/intrinsic-assumed-type.f90
@@ -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(:)

diff  --git a/flang/test/Lower/HLFIR/intrinsic-module-procedures.f90 b/flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
index 7a124e2886510..e7d8536871e55 100644
--- a/flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
+++ b/flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/intrinsic-subroutines.f90 b/flang/test/Lower/HLFIR/intrinsic-subroutines.f90
index 775c1509620d2..9eb05a33dc9aa 100644
--- a/flang/test/Lower/HLFIR/intrinsic-subroutines.f90
+++ b/flang/test/Lower/HLFIR/intrinsic-subroutines.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/matmul.f90 b/flang/test/Lower/HLFIR/matmul.f90
index 624cd03e685d8..93cb700820646 100644
--- a/flang/test/Lower/HLFIR/matmul.f90
+++ b/flang/test/Lower/HLFIR/matmul.f90
@@ -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(:,:)

diff  --git a/flang/test/Lower/HLFIR/null.f90 b/flang/test/Lower/HLFIR/null.f90
index 985b8146fa11c..f80fb0b0d20b1 100644
--- a/flang/test/Lower/HLFIR/null.f90
+++ b/flang/test/Lower/HLFIR/null.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/parent-component-ref.f90 b/flang/test/Lower/HLFIR/parent-component-ref.f90
index df83771a28159..ceba56e730ccb 100644
--- a/flang/test/Lower/HLFIR/parent-component-ref.f90
+++ b/flang/test/Lower/HLFIR/parent-component-ref.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/procedure-designators.f90 b/flang/test/Lower/HLFIR/procedure-designators.f90
index e814cd40bcc96..99f0963dd1a85 100644
--- a/flang/test/Lower/HLFIR/procedure-designators.f90
+++ b/flang/test/Lower/HLFIR/procedure-designators.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/product.f90 b/flang/test/Lower/HLFIR/product.f90
index 274888336b3ba..ff59be3905e95 100644
--- a/flang/test/Lower/HLFIR/product.f90
+++ b/flang/test/Lower/HLFIR/product.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/statement-functions.f90 b/flang/test/Lower/HLFIR/statement-functions.f90
index bb02daaa0a8a4..f66b285ed9452 100644
--- a/flang/test/Lower/HLFIR/statement-functions.f90
+++ b/flang/test/Lower/HLFIR/statement-functions.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/structure-constructor.f90 b/flang/test/Lower/HLFIR/structure-constructor.f90
index 7d6f052c6a9bc..8cf10483ea82a 100644
--- a/flang/test/Lower/HLFIR/structure-constructor.f90
+++ b/flang/test/Lower/HLFIR/structure-constructor.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/substrings.f90 b/flang/test/Lower/HLFIR/substrings.f90
index 3b69b151c2e3e..1a423ebe01bea 100644
--- a/flang/test/Lower/HLFIR/substrings.f90
+++ b/flang/test/Lower/HLFIR/substrings.f90
@@ -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 
diff erent 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)

diff  --git a/flang/test/Lower/HLFIR/sum.f90 b/flang/test/Lower/HLFIR/sum.f90
index 72dbb5b956079..9c2155fee6f74 100644
--- a/flang/test/Lower/HLFIR/sum.f90
+++ b/flang/test/Lower/HLFIR/sum.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/transformational.f90 b/flang/test/Lower/HLFIR/transformational.f90
index eb5860c621975..ed51d86011392 100644
--- a/flang/test/Lower/HLFIR/transformational.f90
+++ b/flang/test/Lower/HLFIR/transformational.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/transpose.f90 b/flang/test/Lower/HLFIR/transpose.f90
index 7d5005d6d5740..05a57e072ccbe 100644
--- a/flang/test/Lower/HLFIR/transpose.f90
+++ b/flang/test/Lower/HLFIR/transpose.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/unary-ops.f90 b/flang/test/Lower/HLFIR/unary-ops.f90
index 11503354930b1..db2c1ceefaa94 100644
--- a/flang/test/Lower/HLFIR/unary-ops.f90
+++ b/flang/test/Lower/HLFIR/unary-ops.f90
@@ -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

diff  --git a/flang/test/Lower/HLFIR/vector-subscript-as-value.f90 b/flang/test/Lower/HLFIR/vector-subscript-as-value.f90
index 067bb65eeffe8..3e3daa8093183 100644
--- a/flang/test/Lower/HLFIR/vector-subscript-as-value.f90
+++ b/flang/test/Lower/HLFIR/vector-subscript-as-value.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/vector-subscript-lhs.f90 b/flang/test/Lower/HLFIR/vector-subscript-lhs.f90
index 62c3481b7995b..f69925fe76955 100644
--- a/flang/test/Lower/HLFIR/vector-subscript-lhs.f90
+++ b/flang/test/Lower/HLFIR/vector-subscript-lhs.f90
@@ -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)

diff  --git a/flang/test/Lower/HLFIR/where.f90 b/flang/test/Lower/HLFIR/where.f90
index 88e49c9d740a3..0f3efcc0b31ab 100644
--- a/flang/test/Lower/HLFIR/where.f90
+++ b/flang/test/Lower/HLFIR/where.f90
@@ -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)

diff  --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index 3eb41d24fa91a..43abea04b8c9c 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -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));
@@ -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(), "",
@@ -311,7 +316,7 @@ 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>());
@@ -319,6 +324,16 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
       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 {


        


More information about the flang-commits mailing list