brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 4b5bb2c Raw
42 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3 4// Tests inlining behavior of `omp.private` ops for `omp.wsloop` ops nested in5// `omp.target` ops.6 7llvm.func @foo(%arg0: !llvm.ptr)8 9omp.private {type = private} @impure_alloca_privatizer : !llvm.ptr init {10^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):11  llvm.call @foo(%arg0) : (!llvm.ptr) -> ()12  omp.yield(%arg1 : !llvm.ptr)13}14 15llvm.func @test_alloca_ip_workaround() {16  omp.target {17    %65 = llvm.mlir.constant(1 : i32) : i3218    %66 = llvm.alloca %65 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr19    %67 = llvm.mlir.constant(0 : index) : i6420    %68 = llvm.mlir.constant(10 : i32) : i3221    %69 = llvm.mlir.constant(1 : i32) : i3222    omp.wsloop private(@impure_alloca_privatizer %66 -> %arg6 : !llvm.ptr) {23      omp.loop_nest (%arg8) : i32 = (%69) to (%68) inclusive step (%69) {24        omp.yield25      }26    }27    omp.terminator28  }29  llvm.return30}31 32// CHECK-LABEL: define {{.*}} @__omp_offloading_{{.*}}_test_alloca_ip_workaround33// CHECK:       entry:34// CHECK:         %[[PRIV_ALLOC:.*]] = alloca ptr, align 835 36// CHECK:       omp.target:37// CHECK:         %[[ALLOC_REG_ARG:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 838// Verify that the `init` region of the privatizer is inlined within the `target`39// region body not before that.40// CHECK:         call void @foo(ptr %[[ALLOC_REG_ARG]])41// CHECK:         br label %omp_loop.preheader42