[flang-commits] [flang] [flang] Converting old lowering tests to the new lowering (PR #172246)
via flang-commits
flang-commits at lists.llvm.org
Sun Dec 14 20:50:03 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
@llvm/pr-subscribers-flang-driver
Author: Eugene Epshteyn (eugeneepshteyn)
<details>
<summary>Changes</summary>
The following tests converted:
Driver/compiler-options.f90
Driver/frontend-forwarding.f90
Driver/optimization-remark.f90
HLFIR/hlfir-flags.f90
Lower/achar.f90
---
Full diff: https://github.com/llvm/llvm-project/pull/172246.diff
5 Files Affected:
- (modified) flang/test/Driver/compiler-options.f90 (+3-3)
- (modified) flang/test/Driver/frontend-forwarding.f90 (-2)
- (modified) flang/test/Driver/optimization-remark.f90 (+1-1)
- (modified) flang/test/HLFIR/hlfir-flags.f90 (+1-6)
- (modified) flang/test/Lower/achar.f90 (+9-6)
``````````diff
diff --git a/flang/test/Driver/compiler-options.f90 b/flang/test/Driver/compiler-options.f90
index cefa86836abd3..b9ecbbda227d1 100644
--- a/flang/test/Driver/compiler-options.f90
+++ b/flang/test/Driver/compiler-options.f90
@@ -1,11 +1,11 @@
-! RUN: %flang -S -emit-llvm -flang-deprecated-no-hlfir -o - %s | FileCheck %s
+! RUN: %flang -S -emit-llvm -o - %s | FileCheck %s
! Test communication of COMPILER_OPTIONS from flang to flang -fc1.
-! CHECK: [[OPTSVAR:@_QQclX[0-9a-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}flang{{(\.exe)?}} {{.*}}-S -emit-llvm -flang-deprecated-no-hlfir -o - {{.*}}compiler-options.f90"
+! CHECK: [[OPTSVAR:@_QQclX[0-9a-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}flang{{(\.exe)?}} {{.*}}-S -emit-llvm -o - {{.*}}compiler-options.f90"
program main
use ISO_FORTRAN_ENV, only: compiler_options
implicit none
character (len = :), allocatable :: v
-! CHECK: call void @llvm.memmove.p0.p0.i64(ptr %{{[0-9]+}}, ptr [[OPTSVAR]], i64 [[OPTSLEN]], i1 false)
+! CHECK: store { ptr, i64, i32, i8, i8, i8, i8 } { ptr [[OPTSVAR]], i64 [[OPTSLEN]],
v = compiler_options()
print *, v
deallocate(v)
diff --git a/flang/test/Driver/frontend-forwarding.f90 b/flang/test/Driver/frontend-forwarding.f90
index 952937168c95d..f47d8010bc233 100644
--- a/flang/test/Driver/frontend-forwarding.f90
+++ b/flang/test/Driver/frontend-forwarding.f90
@@ -19,7 +19,6 @@
! RUN: -fpass-plugin=Bye%pluginext \
! RUN: -fversion-loops-for-stride \
! RUN: -flang-experimental-hlfir \
-! RUN: -flang-deprecated-no-hlfir \
! RUN: -fno-ppc-native-vector-element-order \
! RUN: -fppc-native-vector-element-order \
! RUN: -mllvm -print-before-all \
@@ -50,7 +49,6 @@
! CHECK: "-fpass-plugin=Bye
! CHECK: "-fversion-loops-for-stride"
! CHECK: "-flang-experimental-hlfir"
-! CHECK: "-flang-deprecated-no-hlfir"
! CHECK: "-fno-ppc-native-vector-element-order"
! CHECK: "-fppc-native-vector-element-order"
! CHECK: "-Rpass"
diff --git a/flang/test/Driver/optimization-remark.f90 b/flang/test/Driver/optimization-remark.f90
index 92b3bd8ba2081..76b794720e593 100644
--- a/flang/test/Driver/optimization-remark.f90
+++ b/flang/test/Driver/optimization-remark.f90
@@ -2,7 +2,7 @@
! and -Rpass-analysis)
! loop-delete isn't enabled at O0 so we use at least O1
-! DEFINE: %{output} = -emit-llvm -flang-deprecated-no-hlfir -o /dev/null 2>&1
+! DEFINE: %{output} = -emit-llvm -o /dev/null 2>&1
! Check fc1 can handle -Rpass
! RUN: %flang_fc1 %s -O1 -vectorize-loops -Rpass %{output} 2>&1 | FileCheck %s --check-prefix=REMARKS
diff --git a/flang/test/HLFIR/hlfir-flags.f90 b/flang/test/HLFIR/hlfir-flags.f90
index 0b1e80b1e3f63..168241661e0f5 100644
--- a/flang/test/HLFIR/hlfir-flags.f90
+++ b/flang/test/HLFIR/hlfir-flags.f90
@@ -5,10 +5,9 @@
! RUN: %flang_fc1 -emit-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 --check-prefix FIR --check-prefix ALL %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck %s --check-prefix FIR --check-prefix ALL
! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
-! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
+! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
! | Action | -flang-deprecated-no-hlfir | Result |
! | | / -hlfir=false? | |
@@ -27,18 +26,14 @@ subroutine test(a, res)
! ALL: %[[RES:.*]]: !fir.ref<f32>
! HLFIR: %[[A_VAR:.*]]:2 = hlfir.declare %[[A]]
-! fir.declare is only generated via the hlfir -> fir lowering
! FIR: %[[A_VAR:.*]] = fir.declare %[[A]]
-! NO-HLFIR-NOT: fir.declare
! HLFIR-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]
! FIR: %[[RES_VAR:.*]] = fir.declare %[[RES]]
-! NO-HLFIR-NOT: fir.declare
! HLFIR-NEXT: %[[SUM_RES:.*]] = hlfir.sum %[[A_VAR]]#0
! HLFIR-NEXT: hlfir.assign %[[SUM_RES]] to %[[RES_VAR]]#0
! FIR-NOT: hlfir.
-! NO-HLFIR-NOT: hlfir.
! ALL: return
! ALL-NEXT: }
diff --git a/flang/test/Lower/achar.f90 b/flang/test/Lower/achar.f90
index 9b36d165e5133..f5b3168c424ca 100644
--- a/flang/test/Lower/achar.f90
+++ b/flang/test/Lower/achar.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-fir %s -o - | FileCheck %s
! Tests ACHAR lowering (converting an INTEGER to a CHARACTER (singleton, LEN=1)
! along with conversion of CHARACTER to another KIND.
@@ -13,12 +13,15 @@ end subroutine achar_test1
! CHECK-LABEL: func @_QPachar_test1(
! CHECK-SAME: %[[arg:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
-! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.char<1>
-! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
-! CHECK: %[[VAL_2:.*]] = fir.load %[[arg]] : !fir.ref<i32>
+! CHECK: %[[VAL_TMP_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = ".tmp"}
+! CHECK: %[[VAL_1_ALLOCA:.*]] = fir.alloca !fir.char<1>
+! CHECK: %[[VAL_DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK: %[[VAL_DECLARE:.*]] = fir.declare %[[arg]] dummy_scope %[[VAL_DUMMY_SCOPE]] arg 1 {fortran_attrs = #fir.var_attrs<intent_in>, uniq_name = "_QFachar_test1Ea"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32>
+! CHECK: %[[VAL_CH_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
+! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_DECLARE]] : !fir.ref<i32>
! CHECK: %[[VAL_5:.*]] = fir.undefined !fir.char<1>
! CHECK: %[[VAL_6:.*]] = fir.insert_value %[[VAL_5]], %{{.*}}, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
-! CHECK: fir.store %[[VAL_6]] to %[[VAL_0]] : !fir.ref<!fir.char<1>>
+! CHECK: fir.store %[[VAL_6]] to %[[VAL_1_ALLOCA]] : !fir.ref<!fir.char<1>>
! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.char<2,?>(%{{.*}} : index)
-! CHECK: fir.char_convert %[[VAL_0]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
+! CHECK: fir.char_convert %[[VAL_1_ALLOCA]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
! CHECK: fir.call @_QPachar_test1_foo(%{{.*}}) {{.*}}: (!fir.boxchar<2>) -> ()
``````````
</details>
https://github.com/llvm/llvm-project/pull/172246
More information about the flang-commits
mailing list