brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 7659995 Raw
39 lines · plain
1// RUN: fir-opt --fir-to-llvm-ir %s | FileCheck %s2 3// Tests that private allocations of an `omp.teams` op remain nested inside the4// owning `omp.teams` op after FIR to LLVM conversion.5 6func.func @foo() {7  omp.teams {8    %2 = fir.alloca f32 {bindc_name = "priv_val", pinned, uniq_name = "_QFEpriv_val"}9    %3 = fir.alloca i32 {bindc_name = "i", pinned, uniq_name = "_QFEi"}10    %c1_i32 = arith.constant 1 : i3211    %c1000_i32 = arith.constant 1000 : i3212    %c1_i32_0 = arith.constant 1 : i3213    omp.distribute {14      omp.loop_nest (%arg0) : i32 = (%c1_i32) to (%c1000_i32) inclusive step (%c1_i32_0) {15        fir.store %arg0 to %3 : !fir.ref<i32>16        omp.yield17      }18    }19    omp.terminator20  }21  return22}23 24// CHECK-LABEL:   llvm.func @foo() {25// CHECK:           omp.teams {26// CHECK:             %[[TEAMS_IV_ALLOC:.*]] = llvm.alloca %{{.*}} x i32 {bindc_name = "i", pinned}27// CHECK:             %[[TEAMS_PRIV_ALLOC:.*]] = llvm.alloca %{{.*}} x f32 {bindc_name = "priv_val", pinned}28// CHECK:             omp.distribute {29// CHECK:               omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {30// CHECK:                 llvm.store %{{.*}}, %[[TEAMS_IV_ALLOC]] : i32, !llvm.ptr31// CHECK:                 omp.yield32// CHECK:               }33// CHECK:             }34// CHECK:             omp.terminator35// CHECK:           }36// CHECK:           llvm.return37// CHECK:         }38 39