/// Verify that converts are only generated correctly without declare ops // RUN: fir-opt %s --fir-to-memref --allow-unregistered-dialect | FileCheck %s // CHECK-LABEL: func.func @nodeclare // CHECK: %[[C1:.*]] = arith.constant 1 : index // CHECK: %[[SHAPE:.*]] = fir.shape %[[C1]] : (index) -> !fir.shape<1> // CHECK: %[[M0:.*]] = fir.convert %arg0 : (!fir.ref>) -> memref<1xi32> // CHECK: %[[M1:.*]] = fir.convert %arg0 : (!fir.ref>) -> memref<1xi32> // CHECK: %[[L0:.*]] = memref.load %[[M0]][%{{.*}}] : memref<1xi32> // CHECK: %[[CARG1:.*]] = fir.convert %arg1 : (!fir.ref) -> memref // CHECK: memref.store %[[L0]], %[[CARG1]][] : memref // CHECK: %[[L1:.*]] = memref.load %[[M1]][%{{.*}}] : memref<1xi32> // CHECK: %[[CARG2:.*]] = fir.convert %arg2 : (!fir.ref) -> memref // CHECK: memref.store %[[L1]], %[[CARG2]][] : memref // CHECK-NOT: fir.array_coor func.func @nodeclare(%arg0: !fir.ref> {fir.bindc_name = "a"}, %arg1: !fir.ref {fir.bindc_name = "b"}, %arg2: !fir.ref {fir.bindc_name = "c"}) attributes {fir.internal_name = ""} { %c1 = arith.constant 1 : index %shape = fir.shape %c1 : (index) -> !fir.shape<1> %0 = fir.array_coor %arg0(%shape) %c1 : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref %1 = fir.load %0 : !fir.ref fir.store %1 to %arg1 : !fir.ref %2 = fir.load %0 : !fir.ref fir.store %2 to %arg2 : !fir.ref return } // CHECK-LABEL: func.func @nodeclare_regions // CHECK-COUNT-4: fir.convert %{{.*}} : (!fir.ref>) -> memref<6xi32> // CHECK-COUNT-1: fir.convert %{{.*}} : (i32) -> f32 // CHECK-NOT: fir.array_coor func.func @nodeclare_regions(%arg0: !fir.ref> {fir.bindc_name = "h11"}, %arg1: !fir.ref> {fir.bindc_name = "rslt"}) attributes {fir.internal_name = "_QPsub11"} { %cst = arith.constant 1.100000e+01 : f32 %c1 = arith.constant 1 : index %c1_i32 = arith.constant 1 : i32 %c0_i32 = arith.constant 0 : i32 %c6 = arith.constant 6 : index %shape = fir.shape %c6 : (index) -> !fir.shape<1> %0 = fir.array_coor %arg1(%shape) %c1 : (!fir.ref>, !fir.shape<1>, index) -> !fir.ref fir.store %c0_i32 to %0 : !fir.ref %1 = fir.load %0 : !fir.ref %2 = fir.convert %1 : (i32) -> f32 %3 = arith.cmpf une, %2, %cst fastmath : f32 fir.if %3 { %4 = fir.load %0 : !fir.ref %5 = arith.addi %4, %c1_i32 : i32 fir.store %5 to %0 : !fir.ref } return }