brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · f8d771d Raw
48 lines · plain
1! Tests that CFG & LLVM conversion is applied to `omp.private` ops.2 3! RUN: split-file %s %t && cd %t4 5! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --enable-delayed-privatization \6! RUN:   -o - test.f90 2>&1 | \7! RUN: fir-opt --cfg-conversion -o test.cfg-conv.mlir8! RUN: FileCheck --input-file=test.cfg-conv.mlir %s --check-prefix="CFGConv"9 10! RUN: fir-opt --convert-hlfir-to-fir --cg-rewrite --fir-to-llvm-ir test.cfg-conv.mlir -o - | \11! RUN: FileCheck %s --check-prefix="LLVMDialect"12 13!--- test.f9014subroutine delayed_privatization_allocatable15  implicit none16  integer, allocatable :: var117 18!$omp parallel private(var1)19  var1 = 1020!$omp end parallel21end subroutine22 23! CFGConv-LABEL: omp.private {type = private}24! CFGConv-SAME: @[[PRIVATIZER_SYM:.*]] : [[BOX_TYPE:!fir.box<!fir.heap<i32>>]] init {25 26! CFGConv-NEXT: ^bb0(%[[PRIV_ARG:.*]]: [[TYPE:!fir.ref<!fir.box<!fir.heap<i32>>>]], %[[PRIV_ALLOC:.*]]: [[TYPE]]):27 28! CFGConv-NEXT:   %[[PRIV_ARG_VAL:.*]] = fir.load %[[PRIV_ARG]] : !fir.ref<!fir.box<!fir.heap<i32>>>29! CFGConv-NEXT:   %[[PRIV_ARG_BOX:.*]] = fir.box_addr %[[PRIV_ARG_VAL]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>30! CFGConv-NEXT:   %[[PRIV_ARG_ADDR:.*]] = fir.convert %[[PRIV_ARG_BOX]] : (!fir.heap<i32>) -> i6431! CFGConv-NEXT:   %[[C0:.*]] = arith.constant 0 : i6432! CFGConv-NEXT:   %[[ALLOC_COND:.*]] = arith.cmpi eq, %[[PRIV_ARG_ADDR]], %[[C0]] : i6433! CFGConv-NEXT:   cf.cond_br %[[ALLOC_COND]], ^[[ZERO_MEM_BB:.*]], ^[[ALLOC_MEM_BB:.*]]34! CFGConv-NEXT: ^[[ZERO_MEM_BB]]:35! CFGConv:        cf.br ^[[DECL_BB:.*]]36! CFGConv:      ^[[ALLOC_MEM_BB]]:37! CFGConv:        fir.allocmem38! CFGConv:        cf.br ^[[DECL_BB:.*]]39! CFGConv-NEXT: ^[[DECL_BB]]:40! CFGConv-NEXT:   omp.yield41 42 43! LLVMDialect-LABEL: omp.private {type = private}44! LLVMDialect-SAME: @[[PRIVATIZER_SYM:.*]] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> init {45! LLVMDialect-NEXT: ^bb0(%[[PRIV_ARG:.*]]: !llvm.ptr, %[[PRIV_ALLOC:.*]]: !llvm.ptr):46! LLVMDialect:        llvm.call @malloc47! LLVMDialect-NOT:    hlfir.declare48