[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
This commit is contained in:
parent
09e57cfd32
commit
1d0f4e413c
@ -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)
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -5,18 +5,14 @@
|
||||
! 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
|
||||
|
||||
! | Action | -flang-deprecated-no-hlfir | Result |
|
||||
! | | / -hlfir=false? | |
|
||||
! | =========== | =========================== | =============================== |
|
||||
! | -emit-hlfir | N | Outputs HLFIR |
|
||||
! | -emit-hlfir | Y | Outputs HLFIR |
|
||||
! | -emit-fir | N | Outputs FIR, lowering via HLFIR |
|
||||
! | -emit-fir | Y | Outputs FIR, using old lowering |
|
||||
! | Action | Result |
|
||||
! | | |
|
||||
! | =========== | =============================== |
|
||||
! | -emit-hlfir | Outputs HLFIR |
|
||||
! | -emit-fir | Outputs FIR, lowering via HLFIR |
|
||||
|
||||
subroutine test(a, res)
|
||||
real :: a(:), res
|
||||
@ -27,18 +23,14 @@ end subroutine
|
||||
! 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: }
|
||||
|
||||
@ -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>) -> ()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user