Skip to content

Commit 1d0f4e4

Browse files
[flang] Converting old lowering tests to the new lowering (part 1) (#172246)
The following tests converted: Driver/compiler-options.f90 Driver/frontend-forwarding.f90 Driver/optimization-remark.f90 HLFIR/hlfir-flags.f90 Lower/achar.f90
1 parent 09e57cf commit 1d0f4e4

File tree

5 files changed

+18
-25
lines changed

5 files changed

+18
-25
lines changed

flang/test/Driver/compiler-options.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
! RUN: %flang -S -emit-llvm -flang-deprecated-no-hlfir -o - %s | FileCheck %s
1+
! RUN: %flang -S -emit-llvm -o - %s | FileCheck %s
22
! Test communication of COMPILER_OPTIONS from flang to flang -fc1.
3-
! 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"
3+
! CHECK: [[OPTSVAR:@_QQclX[0-9a-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}flang{{(\.exe)?}} {{.*}}-S -emit-llvm -o - {{.*}}compiler-options.f90"
44
program main
55
use ISO_FORTRAN_ENV, only: compiler_options
66
implicit none
77
character (len = :), allocatable :: v
8-
! CHECK: call void @llvm.memmove.p0.p0.i64(ptr %{{[0-9]+}}, ptr [[OPTSVAR]], i64 [[OPTSLEN]], i1 false)
8+
! CHECK: store { ptr, i64, i32, i8, i8, i8, i8 } { ptr [[OPTSVAR]], i64 [[OPTSLEN]],
99
v = compiler_options()
1010
print *, v
1111
deallocate(v)

flang/test/Driver/frontend-forwarding.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
! RUN: -fpass-plugin=Bye%pluginext \
2020
! RUN: -fversion-loops-for-stride \
2121
! RUN: -flang-experimental-hlfir \
22-
! RUN: -flang-deprecated-no-hlfir \
2322
! RUN: -fno-ppc-native-vector-element-order \
2423
! RUN: -fppc-native-vector-element-order \
2524
! RUN: -mllvm -print-before-all \
@@ -50,7 +49,6 @@
5049
! CHECK: "-fpass-plugin=Bye
5150
! CHECK: "-fversion-loops-for-stride"
5251
! CHECK: "-flang-experimental-hlfir"
53-
! CHECK: "-flang-deprecated-no-hlfir"
5452
! CHECK: "-fno-ppc-native-vector-element-order"
5553
! CHECK: "-fppc-native-vector-element-order"
5654
! CHECK: "-Rpass"

flang/test/Driver/optimization-remark.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
! and -Rpass-analysis)
33
! loop-delete isn't enabled at O0 so we use at least O1
44

5-
! DEFINE: %{output} = -emit-llvm -flang-deprecated-no-hlfir -o /dev/null 2>&1
5+
! DEFINE: %{output} = -emit-llvm -o /dev/null 2>&1
66

77
! Check fc1 can handle -Rpass
88
! RUN: %flang_fc1 %s -O1 -vectorize-loops -Rpass %{output} 2>&1 | FileCheck %s --check-prefix=REMARKS

flang/test/HLFIR/hlfir-flags.f90

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55
! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
66
! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
77
! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
8-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
98
! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck %s --check-prefix FIR --check-prefix ALL
109
! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
11-
! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
1210

13-
! | Action | -flang-deprecated-no-hlfir | Result |
14-
! | | / -hlfir=false? | |
15-
! | =========== | =========================== | =============================== |
16-
! | -emit-hlfir | N | Outputs HLFIR |
17-
! | -emit-hlfir | Y | Outputs HLFIR |
18-
! | -emit-fir | N | Outputs FIR, lowering via HLFIR |
19-
! | -emit-fir | Y | Outputs FIR, using old lowering |
11+
! | Action | Result |
12+
! | | |
13+
! | =========== | =============================== |
14+
! | -emit-hlfir | Outputs HLFIR |
15+
! | -emit-fir | Outputs FIR, lowering via HLFIR |
2016

2117
subroutine test(a, res)
2218
real :: a(:), res
@@ -27,18 +23,14 @@ subroutine test(a, res)
2723
! ALL: %[[RES:.*]]: !fir.ref<f32>
2824

2925
! HLFIR: %[[A_VAR:.*]]:2 = hlfir.declare %[[A]]
30-
! fir.declare is only generated via the hlfir -> fir lowering
3126
! FIR: %[[A_VAR:.*]] = fir.declare %[[A]]
32-
! NO-HLFIR-NOT: fir.declare
3327

3428
! HLFIR-DAG: %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]
3529
! FIR: %[[RES_VAR:.*]] = fir.declare %[[RES]]
36-
! NO-HLFIR-NOT: fir.declare
3730

3831
! HLFIR-NEXT: %[[SUM_RES:.*]] = hlfir.sum %[[A_VAR]]#0
3932
! HLFIR-NEXT: hlfir.assign %[[SUM_RES]] to %[[RES_VAR]]#0
4033
! FIR-NOT: hlfir.
41-
! NO-HLFIR-NOT: hlfir.
4234

4335
! ALL: return
4436
! ALL-NEXT: }

flang/test/Lower/achar.f90

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
1+
! RUN: bbc -emit-fir %s -o - | FileCheck %s
22

33
! Tests ACHAR lowering (converting an INTEGER to a CHARACTER (singleton, LEN=1)
44
! along with conversion of CHARACTER to another KIND.
@@ -13,12 +13,15 @@ end subroutine achar_test1
1313

1414
! CHECK-LABEL: func @_QPachar_test1(
1515
! CHECK-SAME: %[[arg:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
16-
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.char<1>
17-
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
18-
! CHECK: %[[VAL_2:.*]] = fir.load %[[arg]] : !fir.ref<i32>
16+
! CHECK: %[[VAL_TMP_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = ".tmp"}
17+
! CHECK: %[[VAL_1_ALLOCA:.*]] = fir.alloca !fir.char<1>
18+
! CHECK: %[[VAL_DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
19+
! 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>
20+
! CHECK: %[[VAL_CH_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
21+
! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_DECLARE]] : !fir.ref<i32>
1922
! CHECK: %[[VAL_5:.*]] = fir.undefined !fir.char<1>
2023
! CHECK: %[[VAL_6:.*]] = fir.insert_value %[[VAL_5]], %{{.*}}, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
21-
! CHECK: fir.store %[[VAL_6]] to %[[VAL_0]] : !fir.ref<!fir.char<1>>
24+
! CHECK: fir.store %[[VAL_6]] to %[[VAL_1_ALLOCA]] : !fir.ref<!fir.char<1>>
2225
! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.char<2,?>(%{{.*}} : index)
23-
! CHECK: fir.char_convert %[[VAL_0]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
26+
! CHECK: fir.char_convert %[[VAL_1_ALLOCA]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
2427
! CHECK: fir.call @_QPachar_test1_foo(%{{.*}}) {{.*}}: (!fir.boxchar<2>) -> ()

0 commit comments

Comments
 (0)