1 // Test rewrite of fir.declare. The result is replaced by the memref operand.
2 // RUN: fir-opt --cg-rewrite %s -o - | FileCheck %s
5 func.func @test(%arg0: !fir.ref<!fir.array<12x23xi32>>) {
6 %c-1 = arith.constant -1 : index
7 %c12 = arith.constant 12 : index
8 %c-2 = arith.constant -2 : index
9 %c23 = arith.constant 23 : index
10 %0 = fir.shape_shift %c12, %c-1, %c23, %c-2 : (index, index, index, index) -> !fir.shapeshift<2>
11 %1 = fir.declare %arg0(%0) {uniq_name = "_QFarray_numeric_lboundsEx"} : (!fir.ref<!fir.array<12x23xi32>>, !fir.shapeshift<2>) -> !fir.ref<!fir.array<12x23xi32>>
12 fir.call @bar(%1) : (!fir.ref<!fir.array<12x23xi32>>) -> ()
15 func.func private @bar(%arg0: !fir.ref<!fir.array<12x23xi32>>)
18 // CHECK-LABEL: func.func @test(
19 // CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.array<12x23xi32>>) {
20 // CHECK-NEXT: fir.call @bar(%[[arg0]]) : (!fir.ref<!fir.array<12x23xi32>>) -> ()
22 func.func @useless_shape_with_duplicate_extent_operand(%arg0: !fir.ref<!fir.array<3x3xf32>>) {
23 %c3 = arith.constant 3 : index
24 %1 = fir.shape %c3, %c3 : (index, index) -> !fir.shape<2>
25 %2 = fir.declare %arg0(%1) {uniq_name = "u"} : (!fir.ref<!fir.array<3x3xf32>>, !fir.shape<2>) -> !fir.ref<!fir.array<3x3xf32>>
29 // CHECK-LABEL: func.func @useless_shape_with_duplicate_extent_operand(