llvm-project
19 строк · 761.0 Байт
1// RUN: fir-opt %s | tco | FileCheck %s
2
3// CHECK-LABEL: @set_all_n
4func.func @set_all_n(%n : index, %x : i32) {
5%aTmp = fir.alloca i32, %n
6%aMem = fir.convert %aTmp : (!fir.ref<i32>) -> !fir.ref<!fir.array<?xi32>>
7%c1 = arith.constant 1 : index
8%aDim = fir.shape %n : (index) -> !fir.shape<1>
9%a = fir.embox %aMem(%aDim) : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xi32>>
10// CHECK-DAG: %[[IV:.*]] = phi i64
11// CHECK-DAG: %[[LCV:.*]] = phi i64
12// CHECK: icmp sgt i64 %[[LCV]], 0
13fir.do_loop %i = %c1 to %n step %c1 unordered {
14%1 = fir.coordinate_of %a, %i : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
15// CHECK: store i32 %{{.*}}, ptr %{{.*}}
16fir.store %x to %1 : !fir.ref<i32>
17}
18return
19}
20