brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7e90ba0 Raw
49 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir -split-input-file %s | FileCheck %s2 3// Regression test for https://github.com/llvm/llvm-project/issues/120254.4 5omp.declare_reduction @add_reduction : !llvm.ptr alloc {6  %0 = llvm.mlir.constant(1 : i64) : i647  %1 = llvm.alloca %0 x !llvm.struct<(ptr)> : (i64) -> !llvm.ptr8  omp.yield(%1 : !llvm.ptr)9} init {10^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):11  %6 = llvm.mlir.constant(1 : i32) : i3212  "llvm.intr.memcpy"(%arg1, %arg0, %6) <{isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()13  omp.yield(%arg1 : !llvm.ptr)14} combiner {15^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):16  omp.yield(%arg0 : !llvm.ptr)17} cleanup {18^bb0(%arg0: !llvm.ptr):19  omp.yield20}21 22llvm.func @use_reduction() attributes {fir.bindc_name = "test"} {23  %6 = llvm.mlir.constant(1 : i32) : i3224  omp.parallel {25    %18 = llvm.mlir.constant(1 : i64) : i6426    %19 = llvm.alloca %18 x !llvm.struct<(ptr)> : (i64) -> !llvm.ptr27    omp.wsloop reduction(byref @add_reduction %19 -> %arg0 : !llvm.ptr) {28      omp.loop_nest (%arg1) : i32 = (%6) to (%6) inclusive step (%6) {29        omp.yield30      }31    }32    omp.terminator33  }34  llvm.return35}36 37// CHECK: omp.par.entry:38// CHECK:   %[[RED_REGION_ALLOC:.*]] = alloca { ptr }, i64 1, align 839 40// CHECK: omp.par.region:41// CHECK:   br label %omp.par.region142 43// CHECK: omp.par.region1:44// CHECK:   %[[PAR_REG_VAL:.*]] = alloca { ptr }, i64 1, align 845// CHECK:   br label %omp.reduction.init46 47// CHECK: omp.reduction.init:48// CHECK:   call void @llvm.memcpy{{.*}}(ptr %[[RED_REGION_ALLOC]], ptr %[[PAR_REG_VAL]], {{.*}})49