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
1559 lines
60 KiB
Plaintext
1559 lines
60 KiB
Plaintext
// RUN: fir-opt -split-input-file -verify-diagnostics --strict-fir-volatile-verifier %s
|
|
|
|
// expected-error@+1{{custom op 'fir.string_lit' must have character type}}
|
|
%0 = fir.string_lit "Hello, World!"(13) : !fir.int<32>
|
|
|
|
// -----
|
|
|
|
// expected-error@+1{{custom op 'fir.string_lit' found an invalid constant}}
|
|
%0 = fir.string_lit 20(13) : !fir.int<32>
|
|
|
|
// -----
|
|
|
|
// expected-error@+1{{'fir.string_lit' op values in initializer must be integers}}
|
|
%2 = fir.string_lit [158, 2.0](2) : !fir.char<2>
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_1(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.shape %c10 : (index) -> !fir.shape<1>
|
|
// expected-error@+1{{op operand #0 must be box or class, but got '!fir.ref<!fir.array<?x?xf32>>'}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_2(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.shape %c10 : (index) -> !fir.shape<1>
|
|
// expected-error@+1{{op result #0 must be box or class, but got '!fir.ref<!fir.array<?xf32>>'}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.box<!fir.array<?x?xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_3(%arg0: !fir.box<!fir.array<*:f32>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.shape %c10 : (index) -> !fir.shape<1>
|
|
// expected-error@+1{{op box operand must not have unknown rank or type}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.box<!fir.array<*:f32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_4(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
// expected-error@+1{{op result type must not have unknown rank or type}}
|
|
%0 = fir.rebox %arg0 : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<*:f32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_5(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1>
|
|
// expected-error@+1{{op slice operand rank must match box operand rank}}
|
|
%1 = fir.rebox %arg0 [%0] : (!fir.box<!fir.array<?x?xf32>>, !fir.slice<1>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_6(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1>
|
|
%1 = fir.shift %c1, %c1 : (index, index) -> !fir.shift<2>
|
|
// expected-error@+1{{shape operand and input box ranks must match when there is a slice}}
|
|
%2 = fir.rebox %arg0(%1) [%0] : (!fir.box<!fir.array<?xf32>>, !fir.shift<2>, !fir.slice<1>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_7(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.slice %c1, %c10, %c1 : (index, index, index) -> !fir.slice<1>
|
|
%1 = fir.shape %c10 : (index) -> !fir.shape<1>
|
|
// expected-error@+1{{shape operand must absent or be a fir.shift when there is a slice}}
|
|
%2 = fir.rebox %arg0(%1) [%0] : (!fir.box<!fir.array<?xf32>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_8(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%undef = fir.undefined index
|
|
%0 = fir.slice %c1, %undef, %undef, %c1, %c10, %c1 : (index, index, index, index, index, index) -> !fir.slice<2>
|
|
// expected-error@+1{{result type rank and rank after applying slice operand must match}}
|
|
%1 = fir.rebox %arg0 [%0] : (!fir.box<!fir.array<?x?xf32>>, !fir.slice<2>) -> !fir.box<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_9(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.shift %c10, %c10 : (index, index) -> !fir.shift<2>
|
|
// expected-error@+1{{shape operand and input box ranks must match when the shape is a fir.shift}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.box<!fir.array<?xf32>>, !fir.shift<2>) -> !fir.box<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_10(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%0 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1{{result type and shape operand ranks must match}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.box<!fir.array<?xf32>>, !fir.shape<2>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_11(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
|
%c42 = arith.constant 42 : index
|
|
%0 = fir.shape %c42 : (index) -> !fir.shape<1>
|
|
// expected-error@+1{{op input and output element types must match for intrinsic types}}
|
|
%1 = fir.rebox %arg0(%0) : (!fir.box<!fir.array<?x?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf64>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_rebox_char(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
|
|
%c10 = arith.constant 10 : index
|
|
%1 = fir.shape %c10, %c10 : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1{{op input and output element types must match for intrinsic types}}
|
|
%2 = fir.rebox %arg0(%1) : (!fir.box<!fir.array<?x!fir.char<1,20>>>, !fir.shape<2>) -> !fir.box<!fir.array<10x10x!fir.char<1,10>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%c50 = arith.constant 50 : index
|
|
%shape = fir.shape %c100, %c50 : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1 {{'fir.array_coor' op operand #0 must be any reference or box, but got 'index'}}
|
|
%p = fir.array_coor %c100(%shape) %c1, %c1 : (index, !fir.shape<2>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<f32>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%c50 = arith.constant 50 : index
|
|
%shape = fir.shape %c100, %c50 : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1 {{'fir.array_coor' op must be a reference to an array}}
|
|
%p = fir.array_coor %arr(%shape) %c1, %c1 : (!fir.ref<f32>, !fir.shape<2>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%c50 = arith.constant 50 : index
|
|
%shape = fir.shape %c100, %c50 : (index, index) -> !fir.shape<2>
|
|
%c47 = arith.constant 47 : index
|
|
%c78 = arith.constant 78 : index
|
|
%c3 = arith.constant 3 : index
|
|
%slice = fir.slice %c47, %c78, %c3 : (index,index,index) -> !fir.slice<1>
|
|
// expected-error@+1 {{'fir.array_coor' op rank of dimension in slice mismatched}}
|
|
%p = fir.array_coor %arr(%shape)[%slice] %c1, %c1 : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>, !fir.slice<1>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%shape = fir.shape %c100 : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.array_coor' op rank of dimension mismatched}}
|
|
%p = fir.array_coor %arr(%shape) %c1, %c1 : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<1>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%shift = fir.shift %c1 : (index) -> !fir.shift<1>
|
|
// expected-error@+1 {{'fir.array_coor' op shift can only be provided with fir.box memref}}
|
|
%p = fir.array_coor %arr(%shift) %c1, %c1 : (!fir.ref<!fir.array<?x?xf32>>, !fir.shift<1>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c100 = arith.constant 100 : index
|
|
%c50 = arith.constant 50 : index
|
|
%shape = fir.shape %c100, %c50 : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1 {{'fir.array_coor' op number of indices do not match dim rank}}
|
|
%p = fir.array_coor %arr(%shape) %c1 : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%c2 = arith.constant 2 : index
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
// expected-error@+1 {{'fir.array_load' op operand #0 must be any reference or box, but got 'index'}}
|
|
%av1 = fir.array_load %c2(%s) : (index, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<f32>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
// expected-error@+1 {{'fir.array_load' op must be a reference to an array}}
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<f32>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n: (index, index) -> !fir.shapeshift<1>
|
|
// expected-error@+1 {{'fir.array_load' op rank of dimension mismatched}}
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<1>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%c2 = arith.constant 2 : index
|
|
%shift = fir.shift %c2 : (index) -> !fir.shift<1>
|
|
// expected-error@+1 {{'fir.array_load' op shift can only be provided with fir.box memref}}
|
|
%av1 = fir.array_load %arr1(%shift) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shift<1>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%c47 = arith.constant 47 : index
|
|
%c78 = arith.constant 78 : index
|
|
%c3 = arith.constant 3 : index
|
|
%slice = fir.slice %c47, %c78, %c3 : (index,index,index) -> !fir.slice<1>
|
|
%s = fir.shape_shift %m, %n, %o, %p: (index, index, index, index) -> !fir.shapeshift<2>
|
|
// expected-error@+1 {{'fir.array_load' op rank of dimension in slice mismatched}}
|
|
%av1 = fir.array_load %arr1(%s)[%slice] : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>, !fir.slice<1>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%1 = arith.constant 10 : i32
|
|
// expected-error@+1 {{'fir.coordinate_of' op cannot find coordinate with unknown extents}}
|
|
%2 = fir.coordinate_of %arr, %1 : (!fir.ref<!fir.array<?x?xf32>>, i32) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_coordinate_of(%arr : !fir.ref<!fir.array<*:f32>>) {
|
|
%1 = arith.constant 10 : i32
|
|
// expected-error@+1 {{'fir.coordinate_of' op cannot find coordinate in unknown shape}}
|
|
%2 = fir.coordinate_of %arr, %1 : (!fir.ref<!fir.array<*:f32>>, i32) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_coordinate_of(%arr : !fir.ref<!fir.char<10>>) {
|
|
%1 = arith.constant 10 : i32
|
|
// expected-error@+1 {{'fir.coordinate_of' op cannot apply to this element type}}
|
|
%2 = fir.coordinate_of %arr, %1 : (!fir.ref<!fir.char<10>>, i32) -> !fir.ref<!fir.char<10>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_coordinate_of(%arr : !fir.ref<!fir.char<10, 2>>) {
|
|
%1 = arith.constant 10 : i32
|
|
// expected-error@+1 {{'fir.coordinate_of' op cannot apply to character singleton}}
|
|
%2 = fir.coordinate_of %arr, %1, %1 : (!fir.ref<!fir.char<10, 2>>, i32, i32) -> !fir.ref<!fir.char<10>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
%0 = arith.constant 22 : i32
|
|
// expected-error@+1 {{'fir.embox' op operand #0 must be any reference, but got 'i32'}}
|
|
%1 = fir.embox %0 : (i32) -> !fir.box<i32>
|
|
|
|
// -----
|
|
|
|
func.func @fun(%0 : !fir.ref<i32>) {
|
|
%c_100 = arith.constant 100 : index
|
|
%1 = fir.shape %c_100 : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.embox' op shape must not be provided for a scalar}}
|
|
%2 = fir.embox %0(%1) : (!fir.ref<i32>, !fir.shape<1>) -> !fir.box<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fun(%0 : !fir.ref<i32>) {
|
|
%c_100 = arith.constant 100 : index
|
|
%1 = fir.slice %c_100, %c_100, %c_100 : (index, index, index) -> !fir.slice<1>
|
|
// expected-error@+1 {{'fir.embox' op operand #1 must be any legal shape type, but got '!fir.slice<1>'}}
|
|
%2 = fir.embox %0(%1) : (!fir.ref<i32>, !fir.slice<1>) -> !fir.box<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fun(%0 : !fir.ref<i32>) {
|
|
%c_100 = arith.constant 100 : index
|
|
%1 = fir.shape %c_100 : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.embox' op operand #1 must be FIR slice, but got '!fir.shape<1>'}}
|
|
%2 = fir.embox %0[%1] : (!fir.ref<i32>, !fir.shape<1>) -> !fir.box<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fun(%0 : !fir.ref<i32>) {
|
|
%c_100 = arith.constant 100 : index
|
|
%1 = fir.slice %c_100, %c_100, %c_100 : (index, index, index) -> !fir.slice<1>
|
|
// expected-error@+1 {{'fir.embox' op slice must not be provided for a scalar}}
|
|
%2 = fir.embox %0[%1] : (!fir.ref<i32>, !fir.slice<1>) -> !fir.box<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @embox_tdesc(%arg0: !fir.class<!fir.array<10x!fir.type<derived{a:i32,b:i32}>>>) {
|
|
%0 = fir.alloca i32
|
|
%c1_i32 = arith.constant 1 : i32
|
|
%1 = fir.convert %c1_i32 : (i32) -> index
|
|
%c10_i32 = arith.constant 10 : i32
|
|
%2 = fir.convert %c10_i32 : (i32) -> index
|
|
%c1 = arith.constant 1 : index
|
|
%3 = fir.convert %1 : (index) -> i32
|
|
%4:2 = fir.do_loop %arg2 = %1 to %2 step %c1 iter_args(%arg3 = %3) -> (index, i32) {
|
|
fir.store %arg3 to %0 : !fir.ref<i32>
|
|
%9 = fir.load %0 : !fir.ref<i32>
|
|
%10 = fir.convert %9 : (i32) -> i64
|
|
%c1_i64 = arith.constant 1 : i64
|
|
%11 = arith.subi %10, %c1_i64 : i64
|
|
%12 = fir.coordinate_of %arg0, %11 : (!fir.class<!fir.array<10x!fir.type<derived{a:i32,b:i32}>>>, i64) -> !fir.ref<!fir.type<derived{a:i32,b:i32}>>
|
|
// expected-error@+1 {{'fir.embox' op source_box must be used with fir.class result type}}
|
|
%13 = fir.embox %12 source_box %arg0 : (!fir.ref<!fir.type<derived{a:i32,b:i32}>>, !fir.class<!fir.array<10x!fir.type<derived{a:i32,b:i32}>>>) -> !fir.box<!fir.type<derived{a:i32,b:i32}>>
|
|
%14 = arith.addi %arg2, %c1 : index
|
|
%15 = fir.convert %c1 : (index) -> i32
|
|
%16 = fir.load %0 : !fir.ref<i32>
|
|
%17 = arith.addi %16, %15 : i32
|
|
fir.result %14, %17 : index, i32
|
|
}
|
|
fir.store %4#1 to %0 : !fir.ref<i32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
%lo = arith.constant 1 : index
|
|
%c1 = arith.constant 1 : index
|
|
%up = arith.constant 10 : index
|
|
%okIn = arith.constant 1 : i1
|
|
%shIn = arith.constant 1 : i16
|
|
// expected-error@+1 {{'fir.iterate_while' op expected body first argument to be an index argument for the induction variable}}
|
|
%v:3 = fir.iterate_while (%i = %lo to %up step %c1) and (%ok = %okIn) iter_args(%sh = %shIn) -> (i16, i1, i16) {
|
|
%shNew = fir.call @bar(%sh) : (i16) -> i16
|
|
%okNew = fir.call @foo(%sh) : (i16) -> i1
|
|
fir.result %shNew, %okNew, %shNew : i16, i1, i16
|
|
}
|
|
|
|
// -----
|
|
|
|
%lo = arith.constant 1 : index
|
|
%c1 = arith.constant 1 : index
|
|
%up = arith.constant 10 : index
|
|
%okIn = arith.constant 1 : i1
|
|
%shIn = arith.constant 1 : i16
|
|
// expected-error@+1 {{'fir.iterate_while' op expected body second argument to be an index argument for the induction variable}}
|
|
%v:3 = fir.iterate_while (%i = %lo to %up step %c1) and (%ok = %okIn) iter_args(%sh = %shIn) -> (index, f32, i16) {
|
|
%shNew = fir.call @bar(%sh) : (i16) -> i16
|
|
%dummy = fir.call @foo(%sh) : (i16) -> f32
|
|
fir.result %i, %dummy, %shNew : index, f32, i16
|
|
}
|
|
|
|
// -----
|
|
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
// expected-error@+1 {{'fir.do_loop' op unordered loop has no final value}}
|
|
fir.do_loop %i = %c1 to %c10 step %c1 unordered -> index {
|
|
}
|
|
|
|
// -----
|
|
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
fir.do_loop %i = %c1 to %c10 step %c1 -> index {
|
|
%f1 = arith.constant 1.0 : f32
|
|
// expected-error@+1 {{'fir.result' op types mismatch between result op and its parent}}
|
|
fir.result %f1 : f32
|
|
}
|
|
|
|
// -----
|
|
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
// expected-error@+1 {{'fir.result' op parent of result must have same arity}}
|
|
fir.do_loop %i = %c1 to %c10 step %c1 -> index {
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @ugly_char_convert() {
|
|
%1 = fir.undefined i32
|
|
%2 = fir.undefined !fir.ref<!fir.char<1>>
|
|
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<1>>>
|
|
// expected-error@+1 {{'fir.char_convert' op buffers must have different KIND values}}
|
|
fir.char_convert %2 for %1 to %3 : !fir.ref<!fir.char<1>>, i32, !fir.ref<!fir.array<?x!fir.char<1>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @ugly_char_convert() {
|
|
%1 = fir.undefined i32
|
|
%2 = fir.undefined !fir.ref<!fir.char<1>>
|
|
%3 = fir.undefined !fir.ref<!fir.array<?xf32>>
|
|
// expected-error@+1 {{'fir.char_convert' op not a reference to a character}}
|
|
fir.char_convert %2 for %1 to %3 : !fir.ref<!fir.char<1>>, i32, !fir.ref<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @ugly_char_convert() {
|
|
%1 = fir.undefined i32
|
|
%2 = fir.undefined !fir.ref<!fir.char<1>>
|
|
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>
|
|
// expected-error@+1 {{'fir.char_convert' op operand #0 must be any reference, but got 'i32'}}
|
|
fir.char_convert %1 for %1 to %3 : i32, i32, !fir.ref<!fir.array<?x!fir.char<2,?>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @ugly_char_convert() {
|
|
%1 = fir.undefined i32
|
|
%2 = fir.undefined !fir.ref<!fir.char<1>>
|
|
%3 = fir.undefined !fir.ref<!fir.array<?x!fir.char<2,?>>>
|
|
// expected-error@+1 {{'fir.char_convert' op operand #1 must be any integer, but got '!fir.ref<!fir.char<1>>'}}
|
|
fir.char_convert %2 for %2 to %3 : !fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>, !fir.ref<!fir.array<?x!fir.char<2,?>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<32x32xi32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<32x32xi32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op has uneven number of values in ranges}}
|
|
%2 = "fir.insert_on_range"(%0, %c0_i32) { coor = dense<[0, 31, 0]> : tensor<3xindex> } : (!fir.array<32x32xi32>, i32) -> !fir.array<32x32xi32>
|
|
fir.has_value %2 : !fir.array<32x32xi32>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<32x32xi32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<32x32xi32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op has uneven number of values in ranges}}
|
|
%2 = "fir.insert_on_range"(%0, %c0_i32) { coor = dense<[0]> : tensor<1xindex> } : (!fir.array<32x32xi32>, i32) -> !fir.array<32x32xi32>
|
|
fir.has_value %2 : !fir.array<32x32xi32>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<32x32xi32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<32x32xi32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op negative range bound}}
|
|
%2 = fir.insert_on_range %0, %c0_i32 from (-1) to (0) : (!fir.array<32x32xi32>, i32) -> !fir.array<32x32xi32>
|
|
fir.has_value %2 : !fir.array<32x32xi32>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<32x32xi32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<32x32xi32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op empty range}}
|
|
%2 = fir.insert_on_range %0, %c0_i32 from (10) to (9) : (!fir.array<32x32xi32>, i32) -> !fir.array<32x32xi32>
|
|
fir.has_value %2 : !fir.array<32x32xi32>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<?xi32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<?xi32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op must have constant shape and size}}
|
|
%2 = fir.insert_on_range %0, %c0_i32 from (0) to (10) : (!fir.array<?xi32>, i32) -> !fir.array<?xi32>
|
|
fir.has_value %2 : !fir.array<?xi32>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.global internal @_QEmultiarray : !fir.array<*:i32> {
|
|
%c0_i32 = arith.constant 1 : i32
|
|
%0 = fir.undefined !fir.array<*:i32>
|
|
// expected-error@+1 {{'fir.insert_on_range' op must have constant shape and size}}
|
|
%2 = fir.insert_on_range %0, %c0_i32 from (0) to (10) : (!fir.array<*:i32>, i32) -> !fir.array<*:i32>
|
|
fir.has_value %2 : !fir.array<*:i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf64>>, %n :index) {
|
|
%res = fir.call @array_func() : () -> !fir.array<?xf32>
|
|
%shape = fir.shape %n : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.save_result' op value type must match memory reference type}}
|
|
fir.save_result %res to %buffer(%shape) : !fir.array<?xf32>, !fir.ref<!fir.array<?xf64>>, !fir.shape<1>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<*:f32>>>) {
|
|
%res = fir.call @array_func() : () -> !fir.box<!fir.array<*:f32>>
|
|
// expected-error@+1 {{'fir.save_result' op cannot save !fir.box of unknown rank or type}}
|
|
fir.save_result %res to %buffer : !fir.box<!fir.array<*:f32>>, !fir.ref<!fir.box<!fir.array<*:f32>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<f64>) {
|
|
%res = fir.call @array_func() : () -> f64
|
|
// expected-error@+1 {{'fir.save_result' op operand #0 must be fir.box, fir.array or fir.type, but got 'f64'}}
|
|
fir.save_result %res to %buffer : f64, !fir.ref<f64>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.box<!fir.array<?xf32>>>, %n : index) {
|
|
%res = fir.call @array_func() : () -> !fir.box<!fir.array<?xf32>>
|
|
%shape = fir.shape %n : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.save_result' op must not have shape or length operands if the value is a fir.box}}
|
|
fir.save_result %res to %buffer(%shape) : !fir.box<!fir.array<?xf32>>, !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.shape<1>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
|
|
%res = fir.call @array_func() : () -> !fir.array<?xf32>
|
|
%shape = fir.shape %n, %n : (index, index) -> !fir.shape<2>
|
|
// expected-error@+1 {{'fir.save_result' op shape operand must be provided and have the value rank when the value is a fir.array}}
|
|
fir.save_result %res to %buffer(%shape) : !fir.array<?xf32>, !fir.ref<!fir.array<?xf32>>, !fir.shape<2>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
|
|
%res = fir.call @array_func() : () -> !fir.type<t{x:f32}>
|
|
%shape = fir.shape %n : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.save_result' op shape operand should only be provided if the value is a fir.array}}
|
|
fir.save_result %res to %buffer(%shape) : !fir.type<t{x:f32}>, !fir.ref<!fir.type<t{x:f32}>>, !fir.shape<1>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.type<t{x:f32}>>, %n :index) {
|
|
%res = fir.call @array_func() : () -> !fir.type<t{x:f32}>
|
|
// expected-error@+1 {{'fir.save_result' op length parameters number must match with the value type length parameters}}
|
|
fir.save_result %res to %buffer typeparams %n : !fir.type<t{x:f32}>, !fir.ref<!fir.type<t{x:f32}>>, index
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_save_result(%buffer : !fir.ref<!fir.array<?xf32>>, %n :index) {
|
|
%res = fir.call @array_func() : () -> !fir.array<?xf32>
|
|
%shape = fir.shape %n : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.save_result' op length parameters must not be provided for this value type}}
|
|
fir.save_result %res to %buffer(%shape) typeparams %n : !fir.array<?xf32>, !fir.ref<!fir.array<?xf32>>, !fir.shape<1>, index
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_fetch' op number of indices != dimension of array}}
|
|
%f = fir.array_fetch %av1, %m : (!fir.array<?x?xf32>, index) -> f32
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_fetch' op return type does not match array}}
|
|
%f = fir.array_fetch %av1, %m, %n : (!fir.array<?x?xf32>, index, index) -> i32
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
%f = fir.array_fetch %av1, %m, %n : (!fir.array<?x?xf32>, index, index) -> f32
|
|
// expected-error@+1 {{'fir.array_update' op number of indices != dimension of array}}
|
|
%av2 = fir.array_update %av1, %f, %m : (!fir.array<?x?xf32>, f32, index) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
%c0 = arith.constant 0 : i32
|
|
// expected-error@+1 {{'fir.array_update' op merged value does not have element type}}
|
|
%av2 = fir.array_update %av1, %c0, %m, %n : (!fir.array<?x?xf32>, i32, index, index) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f: !fir.ref<i32>) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_update' op does not support reference type for merge}}
|
|
%av2 = fir.array_update %av1, %f, %m, %n : (!fir.array<?x?xf32>, !fir.ref<i32>, index, index) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @test_misc_ops(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index) {
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
%f = fir.array_fetch %av1, %m, %n : (!fir.array<?x?xf32>, index, index) -> f32
|
|
%av2 = fir.array_update %av1, %f, %m, %n : (!fir.array<?x?xf32>, f32, index, index) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_merge_store' op operand #0 must be result of a fir.array_load op}}
|
|
fir.array_merge_store %av2, %av2 to %arr1 : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_array_modify(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f : f32) {
|
|
%i10 = arith.constant 10 : index
|
|
%j20 = arith.constant 20 : index
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_modify' op number of indices must match array dimension}}
|
|
%addr, %av2 = fir.array_modify %av1, %i10 : (!fir.array<?x?xf32>, index) -> (!fir.ref<f32>, !fir.array<?x?xf32>)
|
|
fir.store %f to %addr : !fir.ref<f32>
|
|
fir.array_merge_store %av1, %av2 to %arr1 : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @slice_must_be_integral() {
|
|
%0 = arith.constant 42 : i32
|
|
%1 = fir.field_index field, !fir.type<t(param:i32){field:i32}> (%0 : i32)
|
|
// expected-error@+1 {{'fir.slice' op operand #0 must be variadic of any integer, but got '!fir.field'}}
|
|
%2 = fir.slice %1, %1, %1 : (!fir.field, !fir.field, !fir.field) -> !fir.slice<1>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%slice = fir.slice %c1, %c10, %c1 substr %c1, %c10 : (index, index, index, index, index) -> !fir.slice<1>
|
|
// expected-error@+1 {{'fir.array_coor' op array_coor cannot take a slice with substring}}
|
|
%p = fir.array_coor %a[%slice] %c1, %c1 : (!fir.ref<!fir.array<?x?xf32>>, !fir.slice<1>, index, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_coor_no_slice_substr(%a : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%slice = fir.slice %c1, %c10, %c1 substr %c1, %c10 : (index, index, index, index, index) -> !fir.slice<1>
|
|
// expected-error@+1 {{'fir.array_load' op array_load cannot take a slice with substring}}
|
|
%v = fir.array_load %a[%slice] : (!fir.ref<!fir.array<?x?xf32>>, !fir.slice<1>) -> !fir.array<?x?xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_merge_store_no_slice_substr(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %n : index, %o : index, %p : index, %f : f32) {
|
|
%i10 = arith.constant 10 : index
|
|
%j20 = arith.constant 20 : index
|
|
%c1 = arith.constant 1 : index
|
|
%c10 = arith.constant 10 : index
|
|
%s = fir.shape_shift %m, %n, %o, %p : (index, index, index, index) -> !fir.shapeshift<2>
|
|
%slice = fir.slice %c1, %c10, %c1 substr %c1, %c10 : (index, index, index, index, index) -> !fir.slice<1>
|
|
%av1 = fir.array_load %arr1(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
|
|
%addr, %av2 = fir.array_modify %av1, %i10, %i10 : (!fir.array<?x?xf32>, index, index) -> (!fir.ref<f32>, !fir.array<?x?xf32>)
|
|
fir.store %f to %addr : !fir.ref<f32>
|
|
// expected-error@+1 {{'fir.array_merge_store' op array_merge_store cannot take a slice with substring}}
|
|
fir.array_merge_store %av1, %av2 to %arr1[%slice] : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>, !fir.slice<1>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%n = arith.constant 0 : index
|
|
%m = arith.constant 50 : index
|
|
%s = fir.shape %n, %m : (index, index) -> !fir.shape<2>
|
|
%v = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_access' op number of indices != dimension of array}}
|
|
%p = fir.array_access %v, %c1 : (!fir.array<?x?xf32>, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @array_access(%a : !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%n = arith.constant 0 : index
|
|
%m = arith.constant 50 : index
|
|
%s = fir.shape %n, %m : (index, index) -> !fir.shape<2>
|
|
%v = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.array<?x?xf32>
|
|
// expected-error@+1 {{'fir.array_access' op return type does not match array}}
|
|
%p = fir.array_access %v, %c1, %c1 : (!fir.array<?x?xf32>, index, index) -> !fir.ref<f64>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @foo(%arg0: !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c0 = arith.constant 0 : index
|
|
%c9 = arith.constant 9 : index
|
|
%c19 = arith.constant 19 : index
|
|
%c30 = arith.constant 30 : index
|
|
%0 = fir.shape %c30 : (index) -> !fir.shape<1>
|
|
%1 = fir.array_load %arg0(%0) : (!fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>, !fir.shape<1>) -> !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>
|
|
%2 = fir.do_loop %arg1 = %c1 to %c9 step %c1 unordered iter_args(%arg2 = %1) -> (!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>) {
|
|
%3 = fir.field_index c, !fir.type<t{c:!fir.array<20xi32>}>
|
|
%4 = fir.do_loop %arg3 = %c0 to %c19 step %c1 unordered iter_args(%arg4 = %arg2) -> (!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>) {
|
|
// expected-error@+1 {{'fir.array_access' op return type and/or indices do not type check}}
|
|
%5 = fir.array_access %1, %arg1, %3, %arg3 : (!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, index, !fir.field, index) -> !fir.ref<f32>
|
|
%6 = fir.call @ifoo(%5) : (!fir.ref<f32>) -> i32
|
|
%7 = fir.array_update %arg4, %6, %arg1, %3, %arg3 : (!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, i32, index, !fir.field, index) -> !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>
|
|
fir.result %7 : !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>
|
|
}
|
|
fir.result %4 : !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>
|
|
}
|
|
fir.array_merge_store %1, %2 to %arg0 : !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, !fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>, !fir.ref<!fir.array<30x!fir.type<t{c:!fir.array<20xi32>}>>>
|
|
return
|
|
}
|
|
func.func private @ifoo(!fir.ref<f32>) -> i32
|
|
|
|
// -----
|
|
|
|
func.func private @dispatch(%arg0: !fir.class<!fir.type<derived{a:i32,b:i32}>>) -> () {
|
|
// expected-error@+1 {{'fir.dispatch' op pass_arg_pos must be smaller than the number of operands}}
|
|
fir.dispatch "proc1"(%arg0 : !fir.class<!fir.type<derived{a:i32,b:i32}>>) (%arg0 : !fir.class<!fir.type<derived{a:i32,b:i32}>>) {pass_arg_pos = 1 : i32}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func private @dispatch(%arg0: !fir.class<!fir.type<derived{a:i32,b:i32}>>, %arg1: i32) -> () {
|
|
// expected-error@+1 {{'fir.dispatch' op pass_arg_pos must be a polymorphic operand}}
|
|
fir.dispatch "proc1"(%arg0 : !fir.class<!fir.type<derived{a:i32,b:i32}>>) (%arg0, %arg1 : !fir.class<!fir.type<derived{a:i32,b:i32}>>, i32) {pass_arg_pos = 1 : i32}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @test_fortran_var_attrs() {
|
|
// expected-error@+1 {{Unknown fortran variable attribute: volatypo}}
|
|
%0 = fir.alloca f32 {fortran_attrs = #fir.var_attrs<volatypo>}
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_numeric_declare(%arg0: !fir.ref<f32>) {
|
|
%c1 = arith.constant 1 : index
|
|
// expected-error@+1 {{'fir.declare' op requires attribute 'uniq_name'}}
|
|
%0 = fir.declare %arg0 typeparams %c1 {uniq_typo = "x"} : (!fir.ref<f32>, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_numeric_declare(%arg0: !fir.ref<f32>) {
|
|
%c1 = arith.constant 1 : index
|
|
// expected-error@+1 {{'fir.declare' op of numeric, logical, or assumed type entity must not have length parameters}}
|
|
%0 = fir.declare %arg0 typeparams %c1 {uniq_name = "x"} : (!fir.ref<f32>, index) -> !fir.ref<f32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_char_declare(%arg0: !fir.boxchar<1> ) {
|
|
%0:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
|
|
// expected-error@+1 {{'fir.declare' op must be provided exactly one type parameter when its base is a character that is not a box}}
|
|
%1 = fir.declare %0#0 {uniq_name = "c"} : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,?>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_char_declare(%arg0: !fir.boxchar<1> ) {
|
|
%0:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
|
|
// expected-error@+1 {{'fir.declare' op of character entity must have at most one length parameter}}
|
|
%1 = fir.declare %0#0 typeparams %0#1, %0#1 {uniq_name = "c"} : (!fir.ref<!fir.char<1,?>>, index, index) -> !fir.ref<!fir.char<1,?>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_derived_declare(%arg0: !fir.ref<!fir.type<t{field:i32}>>) {
|
|
%c1 = arith.constant 1 : index
|
|
// expected-error@+1 {{'fir.declare' op has too many length parameters}}
|
|
%0 = fir.declare %arg0 typeparams %c1 {uniq_name = "x"} : (!fir.ref<!fir.type<t{field:i32}>>, index) -> !fir.ref<!fir.type<t{field:i32}>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_pdt_declare(%arg0: !fir.ref<!fir.type<pdt(param:i32){field:i32}>>) {
|
|
// expected-error@+1 {{'fir.declare' op must be provided all the derived type length parameters when the base is not a box}}
|
|
%0 = fir.declare %arg0 {uniq_name = "x"} : (!fir.ref<!fir.type<pdt(param:i32){field:i32}>>) -> !fir.ref<!fir.type<pdt(param:i32){field:i32}>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_pdt_declare_2(%arg0: !fir.ref<!fir.type<pdt(param:i32){field:i32}>>) {
|
|
%c1 = arith.constant 1 : index
|
|
// expected-error@+1 {{'fir.declare' op has too many length parameters}}
|
|
%0 = fir.declare %arg0 typeparams %c1, %c1 {uniq_name = "x"} : (!fir.ref<!fir.type<pdt(param:i32){field:i32}>>, index, index) -> !fir.ref<!fir.type<pdt(param:i32){field:i32}>>
|
|
return
|
|
}
|
|
|
|
|
|
// -----
|
|
func.func @bad_array_declare(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
|
|
// expected-error@+1 {{'fir.declare' op of array entity with a raw address base must have a shape operand that is a shape or shapeshift}}
|
|
%0 = fir.declare %arg0 {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>) -> !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_2(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c2 = arith.constant 2 : index
|
|
%shift = fir.shift %c1, %c2 : (index, index) -> !fir.shift<2>
|
|
// expected-error@+1 {{'fir.declare' op of array entity with a raw address base must have a shape operand that is a shape or shapeshift}}
|
|
%0 = fir.declare %arg0(%shift) {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>, !fir.shift<2>) -> !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_3(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%shape = fir.shape %c1 : (index) -> !fir.shape<1>
|
|
// expected-error@+1 {{'fir.declare' op has conflicting shape and base operand ranks}}
|
|
%0 = fir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_4(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%shape = fir.shape_shift %c1, %c1 : (index, index) -> !fir.shapeshift<1>
|
|
// expected-error@+1 {{'fir.declare' op has conflicting shape and base operand ranks}}
|
|
%0 = fir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<1>) -> !fir.ref<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_box(%arg0: !fir.box<!fir.array<?x?xf32>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%shape = fir.shift %c1 : (index) -> !fir.shift<1>
|
|
// expected-error@+1 {{'fir.declare' op has conflicting shape and base operand ranks}}
|
|
%0 = fir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.box<!fir.array<?x?xf32>>, !fir.shift<1>) -> !fir.box<!fir.array<?x?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_char_boxaddr(%arg0: !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?x!fir.char<1,?>>>>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c2 = arith.constant 2 : index
|
|
%shape = fir.shift %c1, %c2 : (index, index) -> !fir.shift<2>
|
|
// expected-error@+1 {{'fir.declare' op for box address must not have a shape operand}}
|
|
%0 = fir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x?x!fir.char<1,?>>>>>, !fir.shift<2>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?x!fir.char<1,?>>>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
func.func @bad_array_declare_unlimited_polymorphic_boxaddr(%arg0: !fir.ref<!fir.class<!fir.ptr<!fir.array<?x?xnone>>>>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c2 = arith.constant 2 : index
|
|
%shape = fir.shift %c1, %c2 : (index, index) -> !fir.shift<2>
|
|
// expected-error@+1 {{'fir.declare' op for box address must not have a shape operand}}
|
|
%0 = fir.declare %arg0(%shape) {uniq_name = "x"} : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x?xnone>>>>, !fir.shift<2>) -> !fir.ref<!fir.class<!fir.ptr<!fir.array<?x?xnone>>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @invalid_selector(%arg : !fir.box<!fir.ref<i32>>) -> i32 {
|
|
%0 = arith.constant 1 : i32
|
|
%2 = arith.constant 3 : i32
|
|
// expected-error@+1{{'fir.select_type' op selector must be polymorphic}}
|
|
fir.select_type %arg : !fir.box<!fir.ref<i32>> [
|
|
#fir.type_is<!fir.int<4>>,^bb1(%0:i32),
|
|
#fir.type_is<!fir.int<8>>,^bb2(%2:i32),
|
|
unit,^bb5 ]
|
|
^bb1(%a : i32) :
|
|
return %a : i32
|
|
^bb2(%b : i32) :
|
|
return %b : i32
|
|
^bb5 :
|
|
%zero = arith.constant 0 : i32
|
|
return %zero : i32
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @logical_to_fp(%arg0: !fir.logical<4>) -> f32 {
|
|
// expected-error@+1{{'fir.convert' op invalid type conversion}}
|
|
%0 = fir.convert %arg0 : (!fir.logical<4>) -> f32
|
|
return %0 : f32
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fp_to_logical(%arg0: f32) -> !fir.logical<4> {
|
|
// expected-error@+1{{'fir.convert' op invalid type conversion}}
|
|
%0 = fir.convert %arg0 : (f32) -> !fir.logical<4>
|
|
return %0 : !fir.logical<4>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @rec_to_rec(%arg0: !fir.type<t1{i:i32, f:f32}>) -> !fir.type<t2{f:f32, i:i32}> {
|
|
// expected-error@+1{{'fir.convert' op invalid type conversion}}
|
|
%0 = fir.convert %arg0 : (!fir.type<t1{i:i32, f:f32}>) -> !fir.type<t2{f:f32, i:i32}>
|
|
return %0 : !fir.type<t2{f:f32, i:i32}>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_box_offset(%not_a_box : !fir.ref<i32>) {
|
|
// expected-error@+1{{'fir.box_offset' op box_ref operand must have !fir.ref<!fir.box<T>> or !fir.ref<!fir.boxchar<k>> type}}
|
|
%addr1 = fir.box_offset %not_a_box base_addr : (!fir.ref<i32>) -> !fir.llvm_ptr<!fir.ref<i32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_box_offset(%boxchar : !fir.ref<!fir.boxchar<1>>) {
|
|
// expected-error@+1{{'fir.box_offset' op cannot address derived_type field of a fir.boxchar}}
|
|
%addr1 = fir.box_offset %boxchar derived_type : (!fir.ref<!fir.boxchar<1>>) -> !fir.llvm_ptr<!fir.ref<!fir.char<1,?>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_box_offset(%no_addendum : !fir.ref<!fir.box<i32>>) {
|
|
// expected-error@+1{{'fir.box_offset' op can only address derived_type field of derived type or unlimited polymorphic fir.box}}
|
|
%addr1 = fir.box_offset %no_addendum derived_type : (!fir.ref<!fir.box<i32>>) -> !fir.llvm_ptr<!fir.tdesc<!fir.type<none>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_assumed_rank_1(%arg0: !fir.ref<!fir.array<*:f32>> ) {
|
|
// expected-error@+1{{'fir.rebox_assumed_rank' op input must be a box or box address}}
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.ref<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:f32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_assumed_rank_2(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
// expected-error@+1{{'fir.rebox_assumed_rank' op result #0 must be box or class, but got '!fir.ref<!fir.box<!fir.array<*:f32>>>'}}
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.box<!fir.array<*:f32>>) -> !fir.ref<!fir.box<!fir.array<*:f32>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_rebox_assumed_rank_3(%arg0: !fir.box<!fir.array<*:f32>> ) {
|
|
// expected-error@+1{{'fir.rebox_assumed_rank' op input and output element types are incompatible}}
|
|
%1 = fir.rebox_assumed_rank %arg0 lbs ones : (!fir.box<!fir.array<*:f32>>) -> !fir.box<!fir.array<*:i32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_is_assumed_size(%arg0: !fir.ref<!fir.array<*:none>>) {
|
|
// expected-error@+1{{op operand #0 must be box or class, but got '!fir.ref<!fir.array<*:none>>'}}
|
|
%1 = fir.is_assumed_size %arg0 : (!fir.ref<!fir.array<*:none>>) -> i1
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
!t=!fir.type<sometype{i:i32}>
|
|
!t2=!fir.type<sometype2{j:i32}>
|
|
func.func @bad_copy_1(%arg0: !fir.ref<!t>, %arg1: !fir.ref<!t2>) {
|
|
// expected-error@+1{{'fir.copy' op source and destination must have the same value type}}
|
|
fir.copy %arg0 to %arg1 no_overlap : !fir.ref<!t>, !fir.ref<!t2>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
!t=!fir.type<sometype{i:i32}>
|
|
func.func @bad_copy_2(%arg0: !fir.ref<!t>, %arg1: !t) {
|
|
// expected-error@+1{{'fir.copy' op operand #0 must be a reference type to a constant size fir.array, fir.char, or fir.type, but got '!fir.type<sometype{i:i32}>'}}
|
|
fir.copy %arg1 to %arg0 no_overlap : !t, !fir.ref<!t>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
!t=!fir.array<?xi32>
|
|
func.func @bad_copy_3(%arg0: !fir.ref<!t>, %arg1: !fir.ref<!t>) {
|
|
// expected-error@+1{{'fir.copy' op operand #0 must be a reference type to a constant size fir.array, fir.char, or fir.type, but got '!fir.ref<!fir.array<?xi32>>'}}
|
|
fir.copy %arg0 to %arg1 no_overlap : !fir.ref<!t>, !fir.ref<!t>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
!t=f32
|
|
func.func @bad_copy_4(%arg0: !fir.ref<!t>, %arg1: !fir.ref<!t>) {
|
|
// expected-error@+1{{'fir.copy' op operand #0 must be a reference type to a constant size fir.array, fir.char, or fir.type, but got '!fir.ref<f32>'}}
|
|
fir.copy %arg0 to %arg1 no_overlap : !fir.ref<!t>, !fir.ref<!t>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array1(%arg0: !fir.ref<!fir.box<!fir.array<?xi32>>>) {
|
|
// expected-error@+1{{op operand #0 must be any boxed array, but got '!fir.ref<!fir.box<!fir.array<?xi32>>>'}}
|
|
%0 = fir.pack_array %arg0 stack whole : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.ref<!fir.box<!fir.array<?xi32>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array2(%arg0: !fir.box<!fir.array<?xi32>>) {
|
|
// expected-error@+1{{op failed to verify that all of {array, result} have same type}}
|
|
%0 = fir.pack_array %arg0 stack whole : (!fir.box<!fir.array<?xi32>>) -> !fir.box<!fir.array<?xi64>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array3(%arg0: !fir.box<!fir.array<?x!fir.char<1,?>>>, %arg1: i32) {
|
|
// expected-error@+1{{op invalid type parameters}}
|
|
%0 = fir.pack_array %arg0 stack whole typeparams %arg1, %arg1 : (!fir.box<!fir.array<?x!fir.char<1,?>>>, i32, i32) -> !fir.box<!fir.array<?x!fir.char<1,?>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array4(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
// expected-error@+1{{op attribute 'max_size' failed to satisfy constraint: 64-bit unsigned integer attribute}}
|
|
%0 = fir.pack_array %arg0 stack whole constraints {max_size = -1 : i64} : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array5(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
// expected-error@+1{{op attribute 'max_element_size' failed to satisfy constraint: 64-bit unsigned integer attribute}}
|
|
%0 = fir.pack_array %arg0 stack whole constraints {max_element_size = -1 : i64} : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array6(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
// expected-error@+1{{op attribute 'min_stride' failed to satisfy constraint: 64-bit unsigned integer attribute}}
|
|
%0 = fir.pack_array %arg0 stack whole constraints {min_stride = -1 : i64} : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_pack_array7(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
// expected-error@+1{{op 'innermost' is invalid for 1D arrays, use 'whole' instead}}
|
|
%0 = fir.pack_array %arg0 stack innermost : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_unpack_array1(%arg0: !fir.ref<!fir.box<!fir.array<?xi32>>>, %arg1: !fir.ref<!fir.box<!fir.array<?xi32>>>) {
|
|
// expected-error@+1{{op operand #0 must be any boxed array, but got '!fir.ref<!fir.box<!fir.array<?xi32>>>'}}
|
|
fir.unpack_array %arg0 to %arg1 stack : !fir.ref<!fir.box<!fir.array<?xi32>>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_unpack_array2(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%0 = fir.pack_array %arg0 stack whole : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
// expected-error@+1{{op the pack operation uses different memory for the temporary (stack vs heap)}}
|
|
fir.unpack_array %0 to %arg0 heap no_copy : !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_unpack_array3(%arg0: !fir.box<!fir.array<?xf32>>) {
|
|
%0 = fir.pack_array %arg0 heap whole no_copy: (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.array<?xf32>>
|
|
// expected-error@+1{{op the pack operation uses different memory for the temporary (stack vs heap)}}
|
|
fir.unpack_array %0 to %arg0 stack : !fir.box<!fir.array<?xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_unpack_array4(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.box<!fir.array<?xi32>>) {
|
|
// expected-note@-1 {{prior use here}}
|
|
// expected-error@+1{{use of value '%arg0' expects different type than prior uses: '!fir.box<!fir.array<?xi32>>' vs '!fir.box<!fir.array<?xf32>>'}}
|
|
fir.unpack_array %arg0 to %arg1 stack : !fir.box<!fir.array<?xi32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_is_contiguous_box(%arg0: !fir.ref<!fir.box<!fir.array<?xi32>>>) -> i1 {
|
|
// expected-error@+1{{op operand #0 must be any box, but got '!fir.ref<!fir.box<!fir.array<?xi32>>>'}}
|
|
%0 = fir.is_contiguous_box %arg0 whole : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> i1
|
|
return %0 : i1
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_box_total_elements(%arg0: !fir.ref<!fir.box<!fir.array<?xi32>>>) -> i32 {
|
|
// expected-error@+1{{op operand #0 must be any box, but got '!fir.ref<!fir.box<!fir.array<?xi32>>>'}}
|
|
%0 = fir.box_total_elements %arg0 : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> i32
|
|
return %0 : i32
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @empty_dc_wrapper_body() {
|
|
// expected-error@+1 {{'fir.do_concurrent' op expects a non-empty block}}
|
|
fir.do_concurrent {
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_wrong_terminator() {
|
|
// expected-error@+1 {{'fir.do_concurrent' op must be terminated by 'fir.do_concurrent.loop'}}
|
|
fir.do_concurrent {
|
|
llvm.return
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_0d() {
|
|
// expected-error@+2 {{'fir.do_concurrent.loop' op needs at least one tuple element for lowerBound, upperBound and step}}
|
|
fir.do_concurrent {
|
|
fir.do_concurrent.loop () = () to () step () {
|
|
%tmp = fir.alloca i32
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_invalid_parent(%arg0: index, %arg1: index) {
|
|
// expected-error@+1 {{'fir.do_concurrent.loop' op expects parent op 'fir.do_concurrent'}}
|
|
"fir.do_concurrent.loop"(%arg0, %arg1) <{operandSegmentSizes = array<i32: 1, 1, 0, 0, 0>}> ({
|
|
^bb0(%arg2: index):
|
|
%tmp = "fir.alloca"() <{in_type = i32, operandSegmentSizes = array<i32: 0, 0>}> : () -> !fir.ref<i32>
|
|
}) : (index, index) -> ()
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_invalid_control(%arg0: index, %arg1: index) {
|
|
// expected-error@+2 {{'fir.do_concurrent.loop' op different number of tuple elements for lowerBound, upperBound or step}}
|
|
fir.do_concurrent {
|
|
"fir.do_concurrent.loop"(%arg0, %arg1) <{operandSegmentSizes = array<i32: 1, 1, 0, 0, 0>}> ({
|
|
^bb0(%arg2: index):
|
|
%tmp = "fir.alloca"() <{in_type = i32, operandSegmentSizes = array<i32: 0, 0>}> : () -> !fir.ref<i32>
|
|
}) : (index, index) -> ()
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_invalid_ind_var(%arg0: index, %arg1: index) {
|
|
// expected-error@+2 {{'fir.do_concurrent.loop' op expects the same number of induction variables: 2 as bound and step values: 1}}
|
|
fir.do_concurrent {
|
|
"fir.do_concurrent.loop"(%arg0, %arg1, %arg0) <{operandSegmentSizes = array<i32: 1, 1, 1, 0, 0>}> ({
|
|
^bb0(%arg3: index, %arg4: index):
|
|
%tmp = "fir.alloca"() <{in_type = i32, operandSegmentSizes = array<i32: 0, 0>}> : () -> !fir.ref<i32>
|
|
}) : (index, index, index) -> ()
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_invalid_ind_var_type(%arg0: index, %arg1: index) {
|
|
// expected-error@+2 {{'fir.do_concurrent.loop' op expects arguments for the induction variable to be of index type}}
|
|
fir.do_concurrent {
|
|
"fir.do_concurrent.loop"(%arg0, %arg1, %arg0) <{operandSegmentSizes = array<i32: 1, 1, 1, 0, 0>}> ({
|
|
^bb0(%arg3: i32):
|
|
%tmp = "fir.alloca"() <{in_type = i32, operandSegmentSizes = array<i32: 0, 0>}> : () -> !fir.ref<i32>
|
|
}) : (index, index, index) -> ()
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_invalid_reduction(%arg0: index, %arg1: index) {
|
|
%sum = fir.alloca i32
|
|
// expected-error@+2 {{'fir.do_concurrent.loop' op mismatch in number of reduction variables and reduction attributes}}
|
|
fir.do_concurrent {
|
|
"fir.do_concurrent.loop"(%arg0, %arg1, %arg0, %sum) <{operandSegmentSizes = array<i32: 1, 1, 1, 0, 1>}> ({
|
|
^bb0(%arg3: index, %sum_arg: i32):
|
|
%tmp = "fir.alloca"() <{in_type = i32, operandSegmentSizes = array<i32: 0, 0>}> : () -> !fir.ref<i32>
|
|
}) : (index, index, index, !fir.ref<i32>) -> ()
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @dc_reduce_no_attr() {
|
|
%3 = fir.alloca i32 {bindc_name = "s", uniq_name = "dc_reduce"}
|
|
%4:2 = hlfir.declare %3 {uniq_name = "dc_reduce"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
%c1 = arith.constant 1 : index
|
|
// expected-error@+2 {{expected attribute value}}
|
|
fir.do_concurrent {
|
|
fir.do_concurrent.loop (%arg0) = (%c1) to (%c1) step (%c1) reduce(@add_reduction_i32 %4#0 -> %arg1 : !fir.ref<i32>) {
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when volatility changes from a fir.convert
|
|
func.func @bad_convert_volatile(%arg0: !fir.ref<i32>) -> !fir.ref<i32, volatile> {
|
|
// expected-error@+1 {{op this conversion does not preserve volatility}}
|
|
%0 = fir.convert %arg0 : (!fir.ref<i32>) -> !fir.ref<i32, volatile>
|
|
return %0 : !fir.ref<i32, volatile>
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when volatility changes from a fir.convert
|
|
func.func @bad_convert_volatile2(%arg0: !fir.ref<i32, volatile>) -> !fir.ref<i32> {
|
|
// expected-error@+1 {{op this conversion does not preserve volatility}}
|
|
%0 = fir.convert %arg0 : (!fir.ref<i32, volatile>) -> !fir.ref<i32>
|
|
return %0 : !fir.ref<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when the element type and the containing type change
|
|
func.func @bad_convert_volatile3(%arg0: !fir.ref<i32>) -> !fir.box<i64> {
|
|
// expected-error@+1 {{'fir.volatile_cast' op types must be identical except for volatility}}
|
|
%0 = fir.volatile_cast %arg0 : (!fir.ref<i32>) -> !fir.box<i64>
|
|
return %0 : !fir.box<i64>
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when the containing type changes
|
|
func.func @bad_convert_volatile4(%arg0: !fir.ref<i32>) -> !fir.box<i32> {
|
|
// expected-error@+1 {{'fir.volatile_cast' op types must be identical except for volatility}}
|
|
%0 = fir.volatile_cast %arg0 : (!fir.ref<i32>) -> !fir.box<i32>
|
|
return %0 : !fir.box<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when the containing type changes
|
|
func.func @bad_convert_volatile5(%arg0: !fir.ref<i32>) -> !fir.box<i32, volatile> {
|
|
// expected-error@+1 {{'fir.volatile_cast' op types must be identical except for volatility}}
|
|
%0 = fir.volatile_cast %arg0 : (!fir.ref<i32>) -> !fir.box<i32, volatile>
|
|
return %0 : !fir.box<i32, volatile>
|
|
}
|
|
|
|
// -----
|
|
|
|
// Should fail when the element type changes
|
|
func.func @bad_convert_volatile6(%arg0: !fir.ref<i32>) -> !fir.ref<i64> {
|
|
// expected-error@+1 {{'fir.volatile_cast' op types must be identical except for volatility}}
|
|
%0 = fir.volatile_cast %arg0 : (!fir.ref<i32>) -> !fir.ref<i64>
|
|
return %0 : !fir.ref<i64>
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.local {type = local} @x.localizer : i32 init {
|
|
^bb0(%arg0: i32, %arg1: i32):
|
|
%0 = arith.constant 0.0 : f32
|
|
// expected-error @below {{Invalid yielded value. Expected type: 'i32', got: 'f32'}}
|
|
fir.yield(%0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{Region argument type mismatch: got 'f32' expected 'i32'.}}
|
|
fir.local {type = local} @x.localizer : i32 init {
|
|
^bb0(%arg0: i32, %arg1: f32):
|
|
fir.yield
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.local {type = local} @x.localizer : f32 init {
|
|
^bb0(%arg0: f32, %arg1: f32):
|
|
fir.yield(%arg0: f32)
|
|
} dealloc {
|
|
^bb0(%arg0: f32):
|
|
// expected-error @below {{Did not expect any values to be yielded.}}
|
|
fir.yield(%arg0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
fir.local {type = local} @x.localizer : i32 init {
|
|
^bb0(%arg0: i32, %arg1: i32):
|
|
// expected-error @below {{expected exit block terminator to be an `fir.yield` op.}}
|
|
fir.unreachable
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{`init`: expected 2 region arguments, got: 1}}
|
|
fir.local {type = local} @x.localizer : f32 init {
|
|
^bb0(%arg0: f32):
|
|
fir.yield(%arg0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{`copy`: expected 2 region arguments, got: 1}}
|
|
fir.local {type = local_init} @x.privatizer : f32 copy {
|
|
^bb0(%arg0: f32):
|
|
fir.yield(%arg0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{`dealloc`: expected 1 region arguments, got: 2}}
|
|
fir.local {type = local} @x.localizer : f32 dealloc {
|
|
^bb0(%arg0: f32, %arg1: f32):
|
|
fir.yield
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{`local` specifiers do not require a `copy` region.}}
|
|
fir.local {type = local} @x.localizer : f32 copy {
|
|
^bb0(%arg0: f32, %arg1 : f32):
|
|
fir.yield(%arg0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
// expected-error @below {{`local_init` specifiers require at least a `copy` region.}}
|
|
fir.local {type = local_init} @x.localizer : f32 init {
|
|
^bb0(%arg0: f32, %arg1: f32):
|
|
fir.yield(%arg0 : f32)
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @wrong_weights_number_in_if_then(%cond: i1) {
|
|
// expected-error @below {{expects number of region weights to match number of regions: 1 vs 2}}
|
|
fir.if %cond weights([50]) {
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @wrong_weights_number_in_if_then_else(%cond: i1) {
|
|
// expected-error @below {{expects number of region weights to match number of regions: 3 vs 2}}
|
|
fir.if %cond weights([50, 40, 10]) {
|
|
} else {
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fir_declare_bad_storage_offset(%arg0: !fir.ref<!fir.array<8xi8>>) {
|
|
%c0 = arith.constant 0 : index
|
|
%addr = fir.address_of(@block_) : !fir.ref<!fir.array<8xi8>>
|
|
%2 = fir.convert %addr : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
|
|
%var = fir.coordinate_of %2, %c0 : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
|
|
// expected-error@+1 {{negative integer literal not valid for unsigned integer type}}
|
|
%decl = fir.declare %var storage (%addr[-1]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<!fir.array<8xi8>>) -> !fir.ref<i8>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
"func.func"() <{function_type = (!fir.ref<!fir.array<8xi8>>) -> (), sym_name = "fir_declare_bad_storage_offset"}> ({
|
|
^bb0(%arg0: !fir.ref<!fir.array<8xi8>>):
|
|
%0 = "arith.constant"() <{value = 0 : index}> : () -> index
|
|
%1 = "fir.address_of"() <{symbol = @block_}> : () -> !fir.ref<!fir.array<8xi8>>
|
|
%2 = "fir.convert"(%1) : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
|
|
%3 = "fir.coordinate_of"(%2, %0) <{baseType = !fir.ref<!fir.array<?xi8>>}> : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
|
|
// expected-error@+1 {{storage offset specified without the storage reference}}
|
|
%4 = "fir.declare"(%3) <{operandSegmentSizes = array<i32: 1, 0, 0, 0, 0>, storage_offset = 1 : ui64, uniq_name = "a"}> : (!fir.ref<i8>) -> !fir.ref<i8>
|
|
"func.return"() : () -> ()
|
|
}) : () -> ()
|
|
|
|
// -----
|
|
|
|
func.func @fir_declare_bad_storage(%arg0: !fir.ref<i8>) {
|
|
// expected-error@+1 {{storage must be a vector}}
|
|
%decl = fir.declare %arg0 storage (%arg0[0]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<i8>) -> !fir.ref<i8>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fir_declare_bad_storage(%arg0: !fir.ref<i8>, %arg1: !fir.ref<!fir.array<?xi8>>) {
|
|
// expected-error@+1 {{storage must have known extent}}
|
|
%decl = fir.declare %arg0 storage (%arg1[0]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<!fir.array<?xi8>>) -> !fir.ref<i8>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fir_declare_bad_storage(%arg0: !fir.ref<i8>, %arg1: !fir.ref<!fir.array<1xi32>>) {
|
|
// expected-error@+1 {{storage must be an array of i8 elements}}
|
|
%decl = fir.declare %arg0 storage (%arg1[0]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<!fir.array<1xi32>>) -> !fir.ref<i8>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @fir_declare_bad_storage_offset(%arg0: !fir.ref<i8>, %arg1: !fir.ref<!fir.array<1xi8>>) {
|
|
// expected-error@+1 {{storage offset exceeds the storage size}}
|
|
%decl = fir.declare %arg0 storage (%arg1[2]) {uniq_name = "a"} : (!fir.ref<i8>, !fir.ref<!fir.array<1xi8>>) -> !fir.ref<i8>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bad_declare_value(%arg0: !fir.ref<i32>) {
|
|
// expected-error@+1 {{'fir.declare_value' op value must be a simple scalar (integer, real, complex, or logical)}}
|
|
fir.declare_value %arg0 {uniq_name = "test"} : !fir.ref<i32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_pointer_input(%arg0: !fir.ref<i32>) -> i32 {
|
|
// expected-error@+1 {{'fir.bitcast' op input type is not bitcast compatible}}
|
|
%0 = fir.bitcast %arg0 : (!fir.ref<i32>) -> i32
|
|
return %0 : i32
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_pointer_output(%arg0: i32) -> !fir.ref<i32> {
|
|
// expected-error@+1 {{'fir.bitcast' op output type is not bitcast compatible}}
|
|
%0 = fir.bitcast %arg0 : (i32) -> !fir.ref<i32>
|
|
return %0 : !fir.ref<i32>
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_complex(%arg0: complex<f32>) -> i64 {
|
|
// expected-error@+1 {{'fir.bitcast' op input type is not bitcast compatible}}
|
|
%0 = fir.bitcast %arg0 : (complex<f32>) -> i64
|
|
return %0 : i64
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_char_not_singleton(%arg0: !fir.char<1,2>) -> i16 {
|
|
// expected-error@+1 {{'fir.bitcast' op input type is not bitcast compatible}}
|
|
%0 = fir.bitcast %arg0 : (!fir.char<1,2>) -> i16
|
|
return %0 : i16
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_box(%arg0: !fir.box<!fir.type<t{i:i32}>>) -> i64 {
|
|
// expected-error@+1 {{'fir.bitcast' op input type is not bitcast compatible}}
|
|
%0 = fir.bitcast %arg0 : (!fir.box<!fir.type<t{i:i32}>>) -> i64
|
|
return %0 : i64
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @bitcast_size_mismatch(%arg0: i32) -> f64 {
|
|
// expected-error@+1 {{'fir.bitcast' op bit size mismatch: input has 32 bits but output has 64 bits}}
|
|
%0 = fir.bitcast %arg0 : (i32) -> f64
|
|
return %0 : f64
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @logical_and_type_mismatch(%a: !fir.logical<4>, %b: !fir.logical<2>) {
|
|
// expected-note@-1 {{prior use here}}
|
|
// expected-error@+1 {{use of value '%b' expects different type than prior uses: '!fir.logical<4>' vs '!fir.logical<2>'}}
|
|
%0 = fir.logical_and %a, %b : !fir.logical<4>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @logical_or_float(%a: f32, %b: f32) {
|
|
// expected-error@+1 {{'fir.logical_or' op operand #0 must be fir.logical or signless integer, but got 'f32'}}
|
|
%0 = fir.logical_or %a, %b : f32
|
|
return
|
|
}
|