brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 1589778 Raw
63 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2// This tests the fix for https://github.com/llvm/llvm-project/issues/1381023// We are only interested in ensuring that the -mlir-to-llvmir pass doesn't crash4 5// CHECK-LABEL: define internal void @_QQmain..omp_par6 7omp.private {type = private} @_QFEi_private_i32 : i328omp.private {type = firstprivate} @_QFEc_firstprivate_i32 : i32 copy {9^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):10%0 = llvm.load %arg0 : !llvm.ptr -> i3211llvm.store %0, %arg1 : i32, !llvm.ptr12omp.yield(%arg1 : !llvm.ptr)13}14llvm.func @_QQmain() {15%0 = llvm.mlir.constant(1 : i64) : i6416%1 = llvm.alloca %0 x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr17%2 = llvm.mlir.constant(1 : i64) : i6418%3 = llvm.alloca %2 x i32 {bindc_name = "c"} : (i64) -> !llvm.ptr19%4 = llvm.mlir.constant(10 : index) : i6420%5 = llvm.mlir.constant(0 : index) : i6421%6 = llvm.mlir.constant(10000 : index) : i6422%7 = llvm.mlir.constant(1 : index) : i6423%8 = llvm.mlir.constant(1 : i64) : i6424%9 = llvm.mlir.addressof @_QFECchunksz : !llvm.ptr25%10 = llvm.mlir.constant(1 : i64) : i6426%11 = llvm.trunc %7 : i64 to i3227llvm.br ^bb1(%11, %4 : i32, i64)28^bb1(%12: i32, %13: i64):  // 2 preds: ^bb0, ^bb229%14 = llvm.icmp "sgt" %13, %5 : i6430llvm.store %12, %3 : i32, !llvm.ptr31omp.task private(@_QFEc_firstprivate_i32 %3 -> %arg0 : !llvm.ptr) {32  %19 = omp.map.info var_ptr(%1 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !llvm.ptr {name = "i"}33  %20 = omp.map.info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !llvm.ptr {name = "c"}34  %21 = omp.map.info var_ptr(%9 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !llvm.ptr {name = "chunksz"}35  omp.target map_entries(%19 -> %arg1, %20 -> %arg2, %21 -> %arg3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {36    %22 = llvm.mlir.constant(9999 : i32) : i3237    %23 = llvm.mlir.constant(1 : i32) : i3238    omp.parallel {39      %24 = llvm.load %arg2 : !llvm.ptr -> i3240      %25 = llvm.add %24, %22 : i3241      omp.wsloop private(@_QFEi_private_i32 %arg1 -> %arg4 : !llvm.ptr) {42        omp.loop_nest (%arg5) : i32 = (%24) to (%25) inclusive step (%23) {43          llvm.store %arg5, %arg4 : i32, !llvm.ptr44          omp.yield45        }46      }47      omp.terminator48    }49    omp.terminator50  }51  omp.terminator52}53llvm.return54}55llvm.mlir.global internal constant @_QFECchunksz() {addr_space = 0 : i32} : i32 {56%0 = llvm.mlir.constant(10000 : i32) : i3257llvm.return %0 : i3258}59llvm.mlir.global internal constant @_QFECn() {addr_space = 0 : i32} : i32 {60%0 = llvm.mlir.constant(100000 : i32) : i3261llvm.return %0 : i3262}63