1 // RUN: tco %s | FileCheck %s
3 // CHECK-LABEL: define void @_QPtest_proc_dummy()
4 // CHECK: %[[VAL_0:.*]] = alloca i32, i64 1, align 4
5 // CHECK: %[[VAL_1:.*]] = alloca { ptr }, i64 1, align 8
6 // CHECK: %[[VAL_2:.*]] = getelementptr { ptr }, ptr %[[VAL_1]], i32 0, i32 0
7 // CHECK: store ptr %[[VAL_0]], ptr %[[VAL_2]], align 8
8 // CHECK: store i32 1, ptr %[[VAL_0]], align 4
9 // CHECK: %[[VAL_3:.*]] = alloca [32 x i8], i64 1, align 1
10 // CHECK: call void @llvm.init.trampoline(ptr %[[VAL_3]], ptr @_QFtest_proc_dummyPtest_proc_dummy_a, ptr %[[VAL_1]])
11 // CHECK: %[[VAL_6:.*]] = call ptr @llvm.adjust.trampoline(ptr %[[VAL_3]])
12 // CHECK: call void @_QPtest_proc_dummy_other(ptr %[[VAL_6]])
14 // CHECK-LABEL: define void @_QFtest_proc_dummyPtest_proc_dummy_a(ptr
15 // CHECK-SAME: %[[VAL_0:.*]], ptr nest %[[VAL_1:.*]])
17 // CHECK-LABEL: define void @_QPtest_proc_dummy_other(ptr
18 // CHECK-SAME: %[[VAL_0:.*]])
19 // CHECK: %[[VAL_1:.*]] = alloca i32, i64 1, align 4
20 // CHECK: store i32 4, ptr %[[VAL_1]], align 4
21 // CHECK: call void %[[VAL_0]](ptr %[[VAL_1]])
23 func.func @_QPtest_proc_dummy() {
24 %c0_i32 = arith.constant 0 : i32
25 %c1_i32 = arith.constant 1 : i32
26 %c-1_i32 = arith.constant -1 : i32
27 %c5_i32 = arith.constant 5 : i32
28 %0 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_proc_dummyEi"}
29 %1 = fir.alloca tuple<!fir.ref<i32>>
30 %2 = fir.coordinate_of %1, %c0_i32 : (!fir.ref<tuple<!fir.ref<i32>>>, i32) -> !fir.llvm_ptr<!fir.ref<i32>>
31 fir.store %0 to %2 : !fir.llvm_ptr<!fir.ref<i32>>
32 fir.store %c1_i32 to %0 : !fir.ref<i32>
33 %3 = fir.address_of(@_QFtest_proc_dummyPtest_proc_dummy_a) : (!fir.ref<i32>, !fir.ref<tuple<!fir.ref<i32>>>) -> ()
34 %4 = fir.emboxproc %3, %1 : ((!fir.ref<i32>, !fir.ref<tuple<!fir.ref<i32>>>) -> (), !fir.ref<tuple<!fir.ref<i32>>>) -> !fir.boxproc<() -> ()>
35 fir.call @_QPtest_proc_dummy_other(%4) : (!fir.boxproc<() -> ()>) -> ()
36 %5 = fir.address_of(@_QQcl.2E2F682E66393000) : !fir.ref<!fir.char<1,8>>
37 %6 = fir.convert %5 : (!fir.ref<!fir.char<1,8>>) -> !fir.ref<i8>
38 %7 = fir.call @_FortranAioBeginExternalListOutput(%c-1_i32, %6, %c5_i32) : (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
39 %8 = fir.load %0 : !fir.ref<i32>
40 %9 = fir.call @_FortranAioOutputInteger32(%7, %8) : (!fir.ref<i8>, i32) -> i1
41 %10 = fir.call @_FortranAioEndIoStatement(%7) : (!fir.ref<i8>) -> i32
44 func.func @_QFtest_proc_dummyPtest_proc_dummy_a(%arg0: !fir.ref<i32> {fir.bindc_name = "j"}, %arg1: !fir.ref<tuple<!fir.ref<i32>>> {fir.host_assoc}) {
45 %c0_i32 = arith.constant 0 : i32
46 %0 = fir.coordinate_of %arg1, %c0_i32 : (!fir.ref<tuple<!fir.ref<i32>>>, i32) -> !fir.llvm_ptr<!fir.ref<i32>>
47 %1 = fir.load %0 : !fir.llvm_ptr<!fir.ref<i32>>
48 %2 = fir.load %1 : !fir.ref<i32>
49 %3 = fir.load %arg0 : !fir.ref<i32>
50 %4 = arith.addi %2, %3 : i32
51 fir.store %4 to %1 : !fir.ref<i32>
54 func.func @_QPtest_proc_dummy_other(%arg0: !fir.boxproc<() -> ()>) {
55 %c4_i32 = arith.constant 4 : i32
56 %0 = fir.alloca i32 {adapt.valuebyref}
57 fir.store %c4_i32 to %0 : !fir.ref<i32>
58 %1 = fir.box_addr %arg0 : (!fir.boxproc<() -> ()>) -> ((!fir.ref<i32>) -> ())
59 fir.call %1(%0) : (!fir.ref<i32>) -> ()
63 // CHECK-LABEL: define void @_QPtest_proc_dummy_char()
64 // CHECK: %[[VAL_0:.*]] = alloca [40 x i8], i64 1, align 1
65 // CHECK: %[[VAL_1:.*]] = alloca [10 x i8], i64 1, align 1
66 // CHECK: %[[VAL_2:.*]] = alloca { { ptr, i64 } }, i64 1, align 8
67 // CHECK: %[[VAL_3:.*]] = getelementptr { { ptr, i64 } }, ptr %[[VAL_2]], i32 0, i32 0
68 // CHECK: %[[VAL_5:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_1]], 0
69 // CHECK: %[[VAL_6:.*]] = insertvalue { ptr, i64 } %[[VAL_5]], i64 10, 1
70 // CHECK: store { ptr, i64 } %[[VAL_6]], ptr %[[VAL_3]], align 8
71 // CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_1]], ptr
72 // CHECK: br label %[[VAL_8:.*]]
73 // CHECK: %[[VAL_11:.*]] = phi
74 // CHECK: %[[VAL_13:.*]] = phi
75 // CHECK: %[[VAL_15:.*]] = icmp sgt i64 %[[VAL_13]], 0
76 // CHECK: %[[VAL_18:.*]] = getelementptr [10 x [1 x i8]], ptr %[[VAL_1]], i32 0, i64 %[[VAL_11]]
77 // CHECK: store [1 x i8] c" ", ptr %[[VAL_18]], align 1
78 // CHECK: %[[VAL_20:.*]] = alloca [32 x i8], i64 1, align 1
79 // CHECK: call void @llvm.init.trampoline(ptr %[[VAL_20]], ptr @_QFtest_proc_dummy_charPgen_message, ptr %[[VAL_2]])
80 // CHECK: %[[VAL_23:.*]] = call ptr @llvm.adjust.trampoline(ptr %[[VAL_20]])
81 // CHECK: %[[VAL_25:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_23]], 0
82 // CHECK: %[[VAL_26:.*]] = insertvalue { ptr, i64 } %[[VAL_25]], i64 10, 1
83 // CHECK: %[[VAL_27:.*]] = call ptr @llvm.stacksave()
84 // CHECK: %[[VAL_28:.*]] = extractvalue { ptr, i64 } %[[VAL_26]], 0
85 // CHECK: %[[VAL_29:.*]] = extractvalue { ptr, i64 } %[[VAL_26]], 1
86 // CHECK: %[[VAL_30:.*]] = call { ptr, i64 } @_QPget_message(ptr %[[VAL_0]], i64 40, ptr %[[VAL_28]], i64 %[[VAL_29]])
87 // CHECK: %[[VAL_32:.*]] = call i1 @_FortranAioOutputAscii(ptr %{{.*}}, ptr %[[VAL_0]], i64 40)
88 // CHECK: call void @llvm.stackrestore(ptr %[[VAL_27]])
90 // CHECK-LABEL: define { ptr, i64 } @_QFtest_proc_dummy_charPgen_message(ptr
91 // CHECK-SAME: %[[VAL_0:.*]], i64 %[[VAL_1:.*]], ptr nest %[[VAL_2:.*]])
92 // CHECK: %[[VAL_3:.*]] = getelementptr { { ptr, i64 } }, ptr %[[VAL_2]], i32 0, i32 0
93 // CHECK: %[[VAL_4:.*]] = load { ptr, i64 }, ptr %[[VAL_3]], align 8
94 // CHECK: %[[VAL_5:.*]] = extractvalue { ptr, i64 } %[[VAL_4]], 0
95 // CHECK: %[[VAL_6:.*]] = extractvalue { ptr, i64 } %[[VAL_4]], 1
96 // CHECK: %[[VAL_8:.*]] = icmp sgt i64 %[[VAL_6]], 10
97 // CHECK: %[[VAL_9:.*]] = select i1 %[[VAL_8]], i64 10, i64 %[[VAL_6]]
98 // CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_0]], ptr %[[VAL_5]], i64 %[[VAL_9]], i1 false)
99 // CHECK: %[[VAL_10:.*]] = sub i64 10, %[[VAL_9]]
100 // CHECK: br label %[[VAL_11:.*]]
101 // CHECK: %[[VAL_14:.*]] = phi i64
102 // CHECK: %[[VAL_16:.*]] = phi i64
103 // CHECK: %[[VAL_18:.*]] = icmp sgt i64 %[[VAL_16]], 0
104 // CHECK: %[[VAL_21:.*]] = getelementptr [1 x i8], ptr %[[VAL_0]], i64 %[[VAL_14]]
105 // CHECK: store [1 x i8] c" ", ptr %[[VAL_21]], align 1
106 // CHECK: %[[VAL_22:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_0]], 0
107 // CHECK: %[[VAL_23:.*]] = insertvalue { ptr, i64 } %[[VAL_22]], i64 10, 1
108 // CHECK: ret { ptr, i64 } %[[VAL_23]]
111 // CHECK-LABEL: define { ptr, i64 } @_QPget_message(ptr
112 // CHECK-SAME: %[[VAL_0:.*]], i64 %[[VAL_1:.*]], ptr %[[VAL_2:.*]], i64
113 // CHECK-SAME: %[[VAL_3:.*]])
114 // CHECK: %[[VAL_4:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_2]], 0
115 // CHECK: %[[VAL_5:.*]] = insertvalue { ptr, i64 } %[[VAL_4]], i64 %[[VAL_3]], 1
116 // CHECK: %[[VAL_7:.*]] = extractvalue { ptr, i64 } %[[VAL_5]], 0
117 // CHECK: %[[VAL_8:.*]] = extractvalue { ptr, i64 } %[[VAL_5]], 1
118 // CHECK: %[[VAL_9:.*]] = call ptr @llvm.stacksave()
119 // CHECK: %[[VAL_10:.*]] = alloca i8, i64 %[[VAL_8]], align 1
120 // CHECK: %[[VAL_12:.*]] = call { ptr, i64 } %[[VAL_7]](ptr %[[VAL_10]], i64 %[[VAL_8]])
121 // CHECK: %[[VAL_13:.*]] = add i64 %[[VAL_8]], 12
122 // CHECK: %[[VAL_14:.*]] = alloca i8, i64 %[[VAL_13]], align 1
123 // CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_14]], ptr {{.*}}, i64 12, i1 false)
124 // CHECK: %[[VAL_18:.*]] = phi i64
125 // CHECK: %[[VAL_20:.*]] = phi i64
126 // CHECK: %[[VAL_22:.*]] = icmp sgt i64 %[[VAL_20]], 0
127 // CHECK: %[[VAL_24:.*]] = sub i64 %[[VAL_18]], 12
128 // CHECK: %[[VAL_26:.*]] = getelementptr [1 x i8], ptr %[[VAL_10]], i64 %[[VAL_24]]
129 // CHECK: %[[VAL_27:.*]] = load [1 x i8], ptr %[[VAL_26]], align 1
130 // CHECK: %[[VAL_29:.*]] = getelementptr [1 x i8], ptr %[[VAL_14]], i64 %[[VAL_18]]
131 // CHECK: store [1 x i8] %[[VAL_27]], ptr %[[VAL_29]], align 1
132 // CHECK: %[[VAL_30:.*]] = icmp sgt i64 %[[VAL_13]], 40
133 // CHECK: %[[VAL_31:.*]] = select i1 %[[VAL_30]], i64 40, i64 %[[VAL_13]]
134 // CHECK: call void @llvm.memmove.p0.p0.i64(ptr %[[VAL_0]], ptr %[[VAL_14]], i64 %[[VAL_31]], i1 false)
135 // CHECK: %[[VAL_32:.*]] = sub i64 40, %[[VAL_31]]
136 // CHECK: %[[VAL_35:.*]] = phi i64
137 // CHECK: %[[VAL_37:.*]] = phi i64
138 // CHECK: %[[VAL_39:.*]] = icmp sgt i64 %[[VAL_37]], 0
139 // CHECK: %[[VAL_42:.*]] = getelementptr [1 x i8], ptr %[[VAL_0]], i64 %[[VAL_35]]
140 // CHECK: store [1 x i8] c" ", ptr %[[VAL_42]], align 1
141 // CHECK: call void @llvm.stackrestore(ptr %[[VAL_9]])
142 // CHECK: %[[VAL_43:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_0]], 0
143 // CHECK: %[[VAL_44:.*]] = insertvalue { ptr, i64 } %[[VAL_43]], i64 40, 1
144 // CHECK: ret { ptr, i64 } %[[VAL_44]]
147 func.func @_QPtest_proc_dummy_char() {
148 %c10 = arith.constant 10 : index
149 %c0_i32 = arith.constant 0 : i32
150 %c9 = arith.constant 9 : index
151 %false = arith.constant false
152 %c1 = arith.constant 1 : index
153 %c32_i8 = arith.constant 32 : i8
154 %c-1_i32 = arith.constant -1 : i32
155 %c6_i32 = arith.constant 6 : i32
156 %c10_i64 = arith.constant 10 : i64
157 %c40 = arith.constant 40 : index
158 %c0 = arith.constant 0 : index
159 %0 = fir.alloca !fir.char<1,40> {bindc_name = ".result"}
160 %1 = fir.alloca !fir.char<1,10> {bindc_name = "message", uniq_name = "_QFtest_proc_dummy_charEmessage"}
161 %2 = fir.alloca tuple<!fir.boxchar<1>>
162 %3 = fir.coordinate_of %2, %c0_i32 : (!fir.ref<tuple<!fir.boxchar<1>>>, i32) -> !fir.ref<!fir.boxchar<1>>
163 %4 = fir.convert %1 : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<!fir.char<1,?>>
164 %5 = fir.emboxchar %4, %c10 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
165 fir.store %5 to %3 : !fir.ref<!fir.boxchar<1>>
166 %6 = fir.address_of(@_QQcl.486920746865726521) : !fir.ref<!fir.char<1,9>>
167 %7 = fir.convert %c9 : (index) -> i64
168 %8 = fir.convert %1 : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<i8>
169 %9 = fir.convert %6 : (!fir.ref<!fir.char<1,9>>) -> !fir.ref<i8>
170 fir.call @llvm.memmove.p0.p0.i64(%8, %9, %7, %false) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
171 %10 = fir.undefined !fir.char<1>
172 %11 = fir.insert_value %10, %c32_i8, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
173 cf.br ^bb1(%c9, %c1 : index, index)
174 ^bb1(%12: index, %13: index): // 2 preds: ^bb0, ^bb2
175 %14 = arith.cmpi sgt, %13, %c0 : index
176 cf.cond_br %14, ^bb2, ^bb3
178 %15 = fir.convert %1 : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<!fir.array<10x!fir.char<1>>>
179 %16 = fir.coordinate_of %15, %12 : (!fir.ref<!fir.array<10x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
180 fir.store %11 to %16 : !fir.ref<!fir.char<1>>
181 %17 = arith.addi %12, %c1 : index
182 %18 = arith.subi %13, %c1 : index
183 cf.br ^bb1(%17, %18 : index, index)
185 %19 = fir.address_of(@_QQcl.2E2F682E66393000) : !fir.ref<!fir.char<1,8>>
186 %20 = fir.convert %19 : (!fir.ref<!fir.char<1,8>>) -> !fir.ref<i8>
187 %21 = fir.call @_FortranAioBeginExternalListOutput(%c-1_i32, %20, %c6_i32) : (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
188 %22 = fir.address_of(@_QFtest_proc_dummy_charPgen_message) : (!fir.ref<!fir.char<1,10>>, index, !fir.ref<tuple<!fir.boxchar<1>>>) -> !fir.boxchar<1>
189 %23 = fir.emboxproc %22, %2 : ((!fir.ref<!fir.char<1,10>>, index, !fir.ref<tuple<!fir.boxchar<1>>>) -> !fir.boxchar<1>, !fir.ref<tuple<!fir.boxchar<1>>>) -> !fir.boxproc<() -> ()>
190 %24 = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
191 %25 = fir.insert_value %24, %23, [0 : index] : (tuple<!fir.boxproc<() -> ()>, i64>, !fir.boxproc<() -> ()>) -> tuple<!fir.boxproc<() -> ()>, i64>
192 %26 = fir.insert_value %25, %c10_i64, [1 : index] : (tuple<!fir.boxproc<() -> ()>, i64>, i64) -> tuple<!fir.boxproc<() -> ()>, i64>
193 %27 = fir.call @llvm.stacksave() : () -> !fir.ref<i8>
194 %28 = fir.call @_QPget_message(%0, %c40, %26) : (!fir.ref<!fir.char<1,40>>, index, tuple<!fir.boxproc<() -> ()>, i64>) -> !fir.boxchar<1>
195 %29 = fir.convert %0 : (!fir.ref<!fir.char<1,40>>) -> !fir.ref<i8>
196 %30 = fir.convert %c40 : (index) -> i64
197 %31 = fir.call @_FortranAioOutputAscii(%21, %29, %30) : (!fir.ref<i8>, !fir.ref<i8>, i64) -> i1
198 fir.call @llvm.stackrestore(%27) : (!fir.ref<i8>) -> ()
199 %32 = fir.call @_FortranAioEndIoStatement(%21) : (!fir.ref<i8>) -> i32
202 func.func @_QFtest_proc_dummy_charPgen_message(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: index, %arg2: !fir.ref<tuple<!fir.boxchar<1>>> {fir.host_assoc}) -> !fir.boxchar<1> {
203 %c0_i32 = arith.constant 0 : i32
204 %c10 = arith.constant 10 : index
205 %false = arith.constant false
206 %c1 = arith.constant 1 : index
207 %c32_i8 = arith.constant 32 : i8
208 %c0 = arith.constant 0 : index
209 %0 = fir.coordinate_of %arg2, %c0_i32 : (!fir.ref<tuple<!fir.boxchar<1>>>, i32) -> !fir.ref<!fir.boxchar<1>>
210 %1 = fir.load %0 : !fir.ref<!fir.boxchar<1>>
211 %2:2 = fir.unboxchar %1 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
212 %3 = fir.convert %arg0 : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<!fir.char<1,?>>
213 %4 = arith.cmpi slt, %c10, %2#1 : index
214 %5 = arith.select %4, %c10, %2#1 : index
215 %6 = fir.convert %5 : (index) -> i64
216 %7 = fir.convert %3 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
217 %8 = fir.convert %2#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
218 fir.call @llvm.memmove.p0.p0.i64(%7, %8, %6, %false) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
219 %9 = fir.undefined !fir.char<1>
220 %10 = fir.insert_value %9, %c32_i8, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
221 %11 = arith.subi %c10, %5 : index
222 cf.br ^bb1(%5, %11 : index, index)
223 ^bb1(%12: index, %13: index): // 2 preds: ^bb0, ^bb2
224 %14 = arith.cmpi sgt, %13, %c0 : index
225 cf.cond_br %14, ^bb2, ^bb3
227 %15 = fir.convert %3 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
228 %16 = fir.coordinate_of %15, %12 : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
229 fir.store %10 to %16 : !fir.ref<!fir.char<1>>
230 %17 = arith.addi %12, %c1 : index
231 %18 = arith.subi %13, %c1 : index
232 cf.br ^bb1(%17, %18 : index, index)
234 %19 = fir.emboxchar %3, %c10 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
235 return %19 : !fir.boxchar<1>
237 func.func @_QPget_message(%arg0: !fir.ref<!fir.char<1,40>>, %arg1: index, %arg2: tuple<!fir.boxproc<() -> ()>, i64> {fir.char_proc}) -> !fir.boxchar<1> {
238 %c40 = arith.constant 40 : index
239 %c12 = arith.constant 12 : index
240 %false = arith.constant false
241 %c1 = arith.constant 1 : index
242 %c32_i8 = arith.constant 32 : i8
243 %c0 = arith.constant 0 : index
244 %0 = fir.convert %arg0 : (!fir.ref<!fir.char<1,40>>) -> !fir.ref<!fir.char<1,?>>
245 %1 = fir.address_of(@_QQcl.6D6573736167652069733A20) : !fir.ref<!fir.char<1,12>>
246 %2 = fir.extract_value %arg2, [0 : index] : (tuple<!fir.boxproc<() -> ()>, i64>) -> !fir.boxproc<() -> ()>
247 %3 = fir.box_addr %2 : (!fir.boxproc<() -> ()>) -> (() -> ())
248 %4 = fir.extract_value %arg2, [1 : index] : (tuple<!fir.boxproc<() -> ()>, i64>) -> i64
249 %5 = fir.call @llvm.stacksave() : () -> !fir.ref<i8>
250 %6 = fir.alloca !fir.char<1,?>(%4 : i64) {bindc_name = ".result"}
251 %7 = fir.convert %3 : (() -> ()) -> ((!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>)
252 %8 = fir.convert %4 : (i64) -> index
253 %9 = fir.call %7(%6, %8) : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
254 %10 = arith.addi %8, %c12 : index
255 %11 = fir.alloca !fir.char<1,?>(%10 : index) {bindc_name = ".chrtmp"}
256 %12 = fir.convert %c12 : (index) -> i64
257 %13 = fir.convert %11 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
258 %14 = fir.convert %1 : (!fir.ref<!fir.char<1,12>>) -> !fir.ref<i8>
259 fir.call @llvm.memmove.p0.p0.i64(%13, %14, %12, %false) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
260 cf.br ^bb1(%c12, %8 : index, index)
261 ^bb1(%15: index, %16: index): // 2 preds: ^bb0, ^bb2
262 %17 = arith.cmpi sgt, %16, %c0 : index
263 cf.cond_br %17, ^bb2, ^bb3
265 %18 = arith.subi %15, %c12 : index
266 %19 = fir.convert %6 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
267 %20 = fir.coordinate_of %19, %18 : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
268 %21 = fir.load %20 : !fir.ref<!fir.char<1>>
269 %22 = fir.convert %11 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
270 %23 = fir.coordinate_of %22, %15 : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
271 fir.store %21 to %23 : !fir.ref<!fir.char<1>>
272 %24 = arith.addi %15, %c1 : index
273 %25 = arith.subi %16, %c1 : index
274 cf.br ^bb1(%24, %25 : index, index)
276 %26 = arith.cmpi slt, %c40, %10 : index
277 %27 = arith.select %26, %c40, %10 : index
278 %28 = fir.convert %27 : (index) -> i64
279 %29 = fir.convert %0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
280 fir.call @llvm.memmove.p0.p0.i64(%29, %13, %28, %false) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
281 %30 = fir.undefined !fir.char<1>
282 %31 = fir.insert_value %30, %c32_i8, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
283 %32 = arith.subi %c40, %27 : index
284 cf.br ^bb4(%27, %32 : index, index)
285 ^bb4(%33: index, %34: index): // 2 preds: ^bb3, ^bb5
286 %35 = arith.cmpi sgt, %34, %c0 : index
287 cf.cond_br %35, ^bb5, ^bb6
289 %36 = fir.convert %0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
290 %37 = fir.coordinate_of %36, %33 : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
291 fir.store %31 to %37 : !fir.ref<!fir.char<1>>
292 %38 = arith.addi %33, %c1 : index
293 %39 = arith.subi %34, %c1 : index
294 cf.br ^bb4(%38, %39 : index, index)
296 fir.call @llvm.stackrestore(%5) : (!fir.ref<i8>) -> ()
297 %40 = fir.emboxchar %0, %c40 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
298 return %40 : !fir.boxchar<1>
300 fir.global linkonce @_QQcl.486920746865726521 constant : !fir.char<1,9> {
301 %0 = fir.string_lit "Hi there!"(9) : !fir.char<1,9>
302 fir.has_value %0 : !fir.char<1,9>
304 func.func private @llvm.memmove.p0.p0.i64(!fir.ref<i8>, !fir.ref<i8>, i64, i1)
305 fir.global linkonce @_QQcl.2E2F682E66393000 constant : !fir.char<1,8> {
306 %0 = fir.string_lit "./h.f90\00"(8) : !fir.char<1,8>
307 fir.has_value %0 : !fir.char<1,8>
309 func.func private @llvm.stacksave() -> !fir.ref<i8>
310 func.func private @llvm.stackrestore(!fir.ref<i8>)
311 fir.global linkonce @_QQcl.6D6573736167652069733A20 constant : !fir.char<1,12> {
312 %0 = fir.string_lit "message is: "(12) : !fir.char<1,12>
313 fir.has_value %0 : !fir.char<1,12>
316 func.func private @_FortranAioOutputAscii(!fir.ref<i8>, !fir.ref<i8>, i64) -> i1 attributes {fir.io, fir.runtime}
317 func.func private @_FortranAioBeginExternalListOutput(i32, !fir.ref<i8>, i32) -> !fir.ref<i8> attributes {fir.io, fir.runtime}
318 func.func private @_FortranAioOutputInteger32(!fir.ref<i8>, i32) -> i1 attributes {fir.io, fir.runtime}
319 func.func private @_FortranAioEndIoStatement(!fir.ref<i8>) -> i32 attributes {fir.io, fir.runtime}