Lines Matching refs:fir

1 // Test array-copy-value pass (copy elision) with fir.array_modify
2 // RUN: fir-opt %s --array-value-copy | FileCheck %s
5 func.func @no_overlap(%arg0: !fir.ref<!fir.array<100xf32>>, %arg1: !fir.ref<!fir.array<100xf32>>) {
10 %0 = fir.alloca f32
11 %1 = fir.shape %c100 : (index) -> !fir.shape<1>
12 …%2 = fir.array_load %arg0(%1) : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>) -> !fir.array<100xf…
13 …%3 = fir.array_load %arg1(%1) : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>) -> !fir.array<100xf…
14 …%4 = fir.do_loop %arg2 = %c0 to %c99 step %c1 unordered iter_args(%arg3 = %2) -> (!fir.array<100xf…
15 %5 = fir.array_fetch %3, %arg2 : (!fir.array<100xf32>, index) -> f32
16 …%6:2 = fir.array_modify %arg3, %arg2 : (!fir.array<100xf32>, index) -> (!fir.ref<f32>, !fir.array<…
17 fir.store %5 to %0 : !fir.ref<f32>
18 fir.call @user_defined_assignment(%6#0, %0) : (!fir.ref<f32>, !fir.ref<f32>) -> ()
19 fir.result %6#1 : !fir.array<100xf32>
21 …fir.array_merge_store %2, %4 to %arg0 : !fir.array<100xf32>, !fir.array<100xf32>, !fir.ref<!fir.ar…
25 // CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100xf32>>,
26 // CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<!fir.array<100xf32>>) {
31 // CHECK: %[[VAL_6:.*]] = fir.alloca f32
32 // CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
33 // CHECK: %[[VAL_8:.*]] = fir.undefined !fir.array<100xf32>
34 // CHECK: %[[VAL_9:.*]] = fir.undefined !fir.array<100xf32>
35 …AL_10:.*]] = fir.do_loop %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_4]] unordered iter_…
38 … %[[VAL_15:.*]] = fir.array_coor %[[VAL_1]](%[[VAL_7]]) %[[VAL_14]] : (!fir.ref<!fir.array<100xf…
39 // CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref<f32>
42 … %[[VAL_19:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_7]]) %[[VAL_18]] : (!fir.ref<!fir.array<100xf…
43 // CHECK: fir.store %[[VAL_16]] to %[[VAL_6]] : !fir.ref<f32>
44 // CHECK: fir.call @user_defined_assignment(%[[VAL_19]], %[[VAL_6]]) : (!fir.ref<f32>, …
45 // CHECK: fir.result %[[VAL_8]] : !fir.array<100xf32>
52 func.func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
58 %0 = fir.alloca f32
59 %1 = fir.shape %c100 : (index) -> !fir.shape<1>
60 …%2 = fir.array_load %arg0(%1) : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>) -> !fir.array<100xf…
61 %3 = fir.slice %c100, %c1, %c-1 : (index, index, index) -> !fir.slice<1>
62 …%4 = fir.array_load %arg0(%1) [%3] : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>, !fir.slice<1>)…
63 …%5 = fir.do_loop %arg1 = %c0 to %c99 step %c1 unordered iter_args(%arg2 = %2) -> (!fir.array<100xf…
64 %6 = fir.array_fetch %4, %arg1 : (!fir.array<100xf32>, index) -> f32
65 …%7:2 = fir.array_modify %arg2, %arg1 : (!fir.array<100xf32>, index) -> (!fir.ref<f32>, !fir.array<…
66 fir.store %6 to %0 : !fir.ref<f32>
67 fir.call @user_defined_assignment(%7#0, %0) : (!fir.ref<f32>, !fir.ref<f32>) -> ()
68 fir.result %7#1 : !fir.array<100xf32>
70 …fir.array_merge_store %2, %5 to %arg0 : !fir.array<100xf32>, !fir.array<100xf32>, !fir.ref<!fir.ar…
74 // CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100xf32>>) {
80 // CHECK: %[[VAL_6:.*]] = fir.alloca f32
81 // CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_1]] : (index) -> !fir.shape<1>
82 // CHECK: %[[VAL_8:.*]] = fir.allocmem !fir.array<100xf32>{{$}}
83 // CHECK: %[[VAL_9:.*]] = fir.convert %[[VAL_1]] : (index) -> index
87 // CHECK: fir.do_loop %[[VAL_13:.*]] = %[[VAL_10]] to %[[VAL_12]] step %[[VAL_11]] {
90 … %[[VAL_16:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_7]]) %[[VAL_15]] : (!fir.ref<!fir.array<100xf…
93 … %[[VAL_20:.*]] = fir.array_coor %[[VAL_8]](%[[VAL_7]]) %[[VAL_19]] : (!fir.heap<!fir.array<100xf…
94 // CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref<f32>
95 // CHECK: fir.store %[[VAL_17]] to %[[VAL_20]] : !fir.ref<f32>
97 // CHECK: %[[VAL_21:.*]] = fir.undefined !fir.array<100xf32>
98 // CHECK: %[[VAL_22:.*]] = fir.slice %[[VAL_1]], %[[VAL_3]], %[[VAL_4]] : (index, index, …
99 // CHECK: %[[VAL_23:.*]] = fir.undefined !fir.array<100xf32>
100 …L_24:.*]] = fir.do_loop %[[VAL_25:.*]] = %[[VAL_5]] to %[[VAL_2]] step %[[VAL_3]] unordered iter_a…
103 … = fir.array_coor %[[VAL_0]](%[[VAL_7]]) {{\[}}%[[VAL_22]]] %[[VAL_28]] : (!fir.ref<!fir.array<100…
104 // CHECK: %[[VAL_30:.*]] = fir.load %[[VAL_29]] : !fir.ref<f32>
107 … %[[VAL_33:.*]] = fir.array_coor %[[VAL_8]](%[[VAL_7]]) %[[VAL_32]] : (!fir.heap<!fir.array<100xf…
108 // CHECK: fir.store %[[VAL_30]] to %[[VAL_6]] : !fir.ref<f32>
109 // CHECK: fir.call @user_defined_assignment(%[[VAL_33]], %[[VAL_6]]) : (!fir.ref<f32>, …
110 // CHECK: fir.result %[[VAL_21]] : !fir.array<100xf32>
112 // CHECK: %[[VAL_34:.*]] = fir.convert %[[VAL_1]] : (index) -> index
116 // CHECK: fir.do_loop %[[VAL_38:.*]] = %[[VAL_35]] to %[[VAL_37]] step %[[VAL_36]] {
119 … %[[VAL_41:.*]] = fir.array_coor %[[VAL_8]](%[[VAL_7]]) %[[VAL_40]] : (!fir.heap<!fir.array<100xf…
122 … %[[VAL_45:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_7]]) %[[VAL_44]] : (!fir.ref<!fir.array<100xf…
123 // CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_41]] : !fir.ref<f32>
124 // CHECK: fir.store %[[VAL_42]] to %[[VAL_45]] : !fir.ref<f32>
126 // CHECK: fir.freemem %[[VAL_8]] : !fir.heap<!fir.array<100xf32>>
130 func.func private @user_defined_assignment(!fir.ref<f32>, !fir.ref<f32>)