CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
145 lines
9.9 KiB
Plaintext
145 lines
9.9 KiB
Plaintext
// Test fir.rebox_assumed_rank lowering to runtime calls in fir-assumed-rank-op pass.
|
|
// RUN: fir-opt -o - --fir-assumed-rank-op %s | FileCheck %s
|
|
|
|
func.func @test_simple(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:f32>>
|
|
fir.call @somefunc(%1) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
return
|
|
}
|
|
func.func @test_simple_zeroes(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs zeroes : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:f32>>
|
|
fir.call @somefunc(%1) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
return
|
|
}
|
|
func.func @test_simple_preserve(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs preserve : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:f32>>
|
|
fir.call @somefunc(%1) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
return
|
|
}
|
|
func.func @test_allocatable(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs preserve : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.heap<!fir.array<*:f32>>>
|
|
fir.call @somefuncalloc(%1) : (!fir.box<!fir.heap<!fir.array<*:f32>>>) -> ()
|
|
return
|
|
}
|
|
func.func @test_pointer(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs preserve : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.ptr<!fir.array<*:f32>>>
|
|
fir.call @somefuncpointer(%1) : (!fir.box<!fir.ptr<!fir.array<*:f32>>>) -> ()
|
|
return
|
|
}
|
|
!t1= !fir.type<t1{i:i32}>
|
|
!t2= !fir.type<t2{t1:!t1, x:f32}>
|
|
func.func @test_new_dtype(%arg0: !fir.box<!fir.array<*:!t2>> ) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.box<!fir.array<*:!t2>>) -> !fir.box<!fir.array<*:!t1>>
|
|
fir.call @somefunct1(%1) : (!fir.box<!fir.array<*:!t1>>) -> ()
|
|
return
|
|
}
|
|
|
|
!sometype = !fir.type<sometype{i:i32}>
|
|
func.func @test_poly_to_nonepoly(%arg0: !fir.class<!fir.array<*:!sometype>>) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.class<!fir.array<*:!sometype>>) -> !fir.box<!fir.array<*:!sometype>>
|
|
fir.call @takes_assumed_rank_t(%1) : (!fir.box<!fir.array<*:!sometype>>) -> ()
|
|
return
|
|
}
|
|
|
|
func.func @test_optional(%arg0: !fir.box<!fir.array<*:f32>>) {
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones optional : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:f32>>
|
|
fir.call @somefunc(%1) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
return
|
|
}
|
|
|
|
func.func private @somefunc(!fir.box<!fir.array<*:f32>>)
|
|
func.func private @somefuncalloc(!fir.box<!fir.heap<!fir.array<*:f32>>>)
|
|
func.func private @somefuncpointer(!fir.box<!fir.ptr<!fir.array<*:f32>>>)
|
|
func.func private @somefunct1(!fir.box<!fir.array<*:!t1>>)
|
|
func.func private @takes_assumed_rank_t(!fir.box<!fir.array<*:!sometype>>)
|
|
|
|
// CHECK-LABEL: func.func @test_simple(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>>) {
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : i32
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 0 : i8
|
|
// CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>
|
|
// CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ref<none>
|
|
// CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>) -> !fir.ref<!fir.box<none>>
|
|
// CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<*:f32>>) -> !fir.box<none>
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%[[VAL_5]], %[[VAL_6]], %[[VAL_4]], %[[VAL_2]], %[[VAL_1]]) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<none>, i8, i32) -> ()
|
|
// CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>
|
|
// CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>) -> !fir.box<!fir.array<*:f32>>
|
|
// CHECK: fir.call @somefunc(%[[VAL_9]]) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
// CHECK: return
|
|
// CHECK: }
|
|
|
|
// CHECK-LABEL: func.func @test_simple_zeroes(
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 2 : i32
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[VAL_1]])
|
|
|
|
// CHECK-LABEL: func.func @test_simple_preserve(
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[VAL_1]])
|
|
|
|
// CHECK-LABEL: func.func @test_allocatable(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>>) {
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 2 : i8
|
|
// CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>
|
|
// CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ref<none>
|
|
// CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>>) -> !fir.ref<!fir.box<none>>
|
|
// CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<*:f32>>) -> !fir.box<none>
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%[[VAL_5]], %[[VAL_6]], %[[VAL_4]], %[[VAL_2]], %[[VAL_1]]) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<none>, i8, i32) -> ()
|
|
// CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_3]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>>
|
|
// CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (!fir.box<!fir.heap<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>) -> !fir.box<!fir.heap<!fir.array<*:f32>>>
|
|
// CHECK: fir.call @somefuncalloc(%[[VAL_9]]) : (!fir.box<!fir.heap<!fir.array<*:f32>>>) -> ()
|
|
// CHECK: return
|
|
// CHECK: }
|
|
|
|
// CHECK-LABEL: func.func @test_pointer(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>>) {
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 1 : i8
|
|
// CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>
|
|
// CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ref<none>
|
|
// CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>>) -> !fir.ref<!fir.box<none>>
|
|
// CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<*:f32>>) -> !fir.box<none>
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%[[VAL_5]], %[[VAL_6]], %[[VAL_4]], %[[VAL_2]], %[[VAL_1]]) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<none>, i8, i32) -> ()
|
|
// CHECK: %[[VAL_8:.*]] = fir.load %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>>
|
|
// CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (!fir.box<!fir.ptr<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?xf32>>>) -> !fir.box<!fir.ptr<!fir.array<*:f32>>>
|
|
// CHECK: fir.call @somefuncpointer(%[[VAL_9]]) : (!fir.box<!fir.ptr<!fir.array<*:f32>>>) -> ()
|
|
// CHECK: return
|
|
// CHECK: }
|
|
|
|
// CHECK-LABEL: func.func @test_new_dtype(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:!fir.type<t2{t1:!fir.type<t1{i:i32}>,x:f32}>>>) {
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : i32
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 0 : i8
|
|
// CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?x!fir.type<t1{i:i32}>>>
|
|
// CHECK: %[[VAL_4:.*]] = fir.type_desc !fir.type<t1{i:i32}>
|
|
// CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?x!fir.type<t1{i:i32}>>>>) -> !fir.ref<!fir.box<none>>
|
|
// CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<*:!fir.type<t2{t1:!fir.type<t1{i:i32}>,x:f32}>>>) -> !fir.box<none>
|
|
// CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_4]] : (!fir.tdesc<!fir.type<t1{i:i32}>>) -> !fir.ref<none>
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%[[VAL_5]], %[[VAL_6]], %[[VAL_7]], %[[VAL_2]], %[[VAL_1]]) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<none>, i8, i32) -> ()
|
|
// CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_3]] : !fir.ref<!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?x!fir.type<t1{i:i32}>>>>
|
|
// CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (!fir.box<!fir.array<?x?x?x?x?x?x?x?x?x?x?x?x?x?x?x!fir.type<t1{i:i32}>>>) -> !fir.box<!fir.array<*:!fir.type<t1{i:i32}>>>
|
|
// CHECK: fir.call @somefunct1(%[[VAL_10]]) : (!fir.box<!fir.array<*:!fir.type<t1{i:i32}>>>) -> ()
|
|
// CHECK: return
|
|
// CHECK: }
|
|
|
|
// CHECK-LABEL: func.func @test_poly_to_nonepoly(
|
|
// CHECK: %[[VAL_4:.*]] = fir.type_desc !fir.type<sometype{i:i32}>
|
|
// CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_4]] : (!fir.tdesc<!fir.type<sometype{i:i32}>>) -> !fir.ref<none>
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(%{{.*}}, %{{.*}}, %[[VAL_7]],
|
|
|
|
// CHECK-LABEL: func.func @test_optional(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<*:f32>>) {
|
|
// CHECK: %[[IS_PRESENT:.*]] = fir.is_present %[[VAL_0]] : (!fir.box<!fir.array<*:f32>>) -> i1
|
|
// CHECK: %[[RES:.*]] = fir.if %[[IS_PRESENT]] -> (!fir.box<!fir.array<*:f32>>) {
|
|
// CHECK: fir.call @_FortranACopyAndUpdateDescriptor(
|
|
// CHECK: %[[LOADED:.*]] = fir.load
|
|
// CHECK: %[[CAST:.*]] = fir.convert %[[LOADED]]
|
|
// CHECK: fir.result %[[CAST]] : !fir.box<!fir.array<*:f32>>
|
|
// CHECK: } else {
|
|
// CHECK: %[[ABSENT:.*]] = fir.absent !fir.box<!fir.array<*:f32>>
|
|
// CHECK: fir.result %[[ABSENT]] : !fir.box<!fir.array<*:f32>>
|
|
// CHECK: }
|
|
// CHECK: fir.call @somefunc(%[[RES]]) : (!fir.box<!fir.array<*:f32>>) -> ()
|
|
|
|
// CHECK: func.func private @_FortranACopyAndUpdateDescriptor(!fir.ref<!fir.box<none>> {llvm.nocapture}, !fir.box<none> {llvm.nocapture}, !fir.ref<none>, i8, i32) attributes {fir.runtime}
|