brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · cbe599f Raw
58 lines · plain
1// RUN: fir-opt --cfg-conversion %s | FileCheck %s2 3omp.declare_reduction @add_reduction_i_32_box_3_byref : !fir.ref<!fir.box<!fir.array<3xi32>>> init {4^bb0(%arg0: !fir.ref<!fir.box<!fir.array<3xi32>>>):5  %c4_i32 = arith.constant 4 : i326  %c0_i32 = arith.constant 0 : i327  %c3 = arith.constant 3 : index8  %0 = fir.alloca !fir.box<!fir.array<3xi32>>9  %1 = fir.alloca !fir.array<3xi32> {bindc_name = "omp.reduction.array.init"}10  %2 = fir.shape %c3 : (index) -> !fir.shape<1>11  %3 = fir.declare %1(%2) {uniq_name = "omp.reduction.array.init"} : (!fir.ref<!fir.array<3xi32>>, !fir.shape<1>) -> !fir.ref<!fir.array<3xi32>>12  %4 = fir.embox %3(%2) : (!fir.ref<!fir.array<3xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<3xi32>>13  %5 = fir.alloca i3214  fir.store %c0_i32 to %5 : !fir.ref<i32>15  %6 = fir.embox %5 : (!fir.ref<i32>) -> !fir.box<i32>16  fir.store %4 to %0 : !fir.ref<!fir.box<!fir.array<3xi32>>>17  %7 = fir.address_of(@_QQclX9a9fdf8c5fd329fbbf2b0c08e2ca9a1e) : !fir.ref<!fir.char<1,40>>18  %8 = fir.convert %0 : (!fir.ref<!fir.box<!fir.array<3xi32>>>) -> !fir.ref<!fir.box<none>>19  %9 = fir.convert %6 : (!fir.box<i32>) -> !fir.box<none>20  %10 = fir.convert %7 : (!fir.ref<!fir.char<1,40>>) -> !fir.ref<i8>21  fir.call @_FortranAAssign(%8, %9, %10, %c4_i32) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> ()22  %12 = fir.alloca !fir.box<!fir.array<3xi32>>23  fir.store %4 to %12 : !fir.ref<!fir.box<!fir.array<3xi32>>>24  omp.yield(%12 : !fir.ref<!fir.box<!fir.array<3xi32>>>)25} combiner {26^bb0(%arg0: !fir.ref<!fir.box<!fir.array<3xi32>>>, %arg1: !fir.ref<!fir.box<!fir.array<3xi32>>>):27  %c1 = arith.constant 1 : index28  %c0 = arith.constant 0 : index29  %0 = fir.load %arg0 : !fir.ref<!fir.box<!fir.array<3xi32>>>30  %1 = fir.load %arg1 : !fir.ref<!fir.box<!fir.array<3xi32>>>31  %2:3 = fir.box_dims %0, %c0 : (!fir.box<!fir.array<3xi32>>, index) -> (index, index, index)32  %3 = fir.shape_shift %2#0, %2#1 : (index, index) -> !fir.shapeshift<1>33  fir.do_loop %arg2 = %c1 to %2#1 step %c1 unordered {34    %4 = fir.array_coor %0(%3) %arg2 : (!fir.box<!fir.array<3xi32>>, !fir.shapeshift<1>, index) -> !fir.ref<i32>35    %5 = fir.array_coor %1(%3) %arg2 : (!fir.box<!fir.array<3xi32>>, !fir.shapeshift<1>, index) -> !fir.ref<i32>36    %6 = fir.load %4 : !fir.ref<i32>37    %7 = fir.load %5 : !fir.ref<i32>38    %8 = arith.addi %6, %7 : i3239    fir.store %8 to %4 : !fir.ref<i32>40  }41  omp.yield(%arg0 : !fir.ref<!fir.box<!fir.array<3xi32>>>)42}43 44// ensure cfg conversion has run on the do loop45// CHECK: combiner {46// CHECK-NOT: fir.do_loop47// CHECK: ^bb0({{.*}}):48// ...49// CHECK:   cf.br ^bb150// CHECK: ^bb1({{.*}}):51// ...52// CHECK:   cf.cond_br %{{.*}} ^bb2, ^bb353// CHECK: ^bb2:54// ...55// CHECK:   cf.br ^bb156// CHECK: ^bb3:57 58