brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 612bb55 Raw
61 lines · plain
1! Test delayed privatization for allocatables: `firstprivate`.2 3! RUN: split-file %s %t4 5! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --enable-delayed-privatization \6! RUN:   -o - %t/test_ir.f90 2>&1 | FileCheck %s7! RUN: bbc -emit-hlfir -fopenmp --enable-delayed-privatization -o - %t/test_ir.f90 2>&1 |\8! RUN:   FileCheck %s9 10!--- test_ir.f9011subroutine delayed_privatization_allocatable12  implicit none13  integer, allocatable :: var114 15!$omp parallel firstprivate(var1)16  var1 = 1017!$omp end parallel18end subroutine19 20! CHECK-LABEL: omp.private {type = firstprivate}21! CHECK-SAME: @[[PRIVATIZER_SYM:.*]] : [[BOX_TYPE:!fir.box<!fir.heap<i32>>]] init {22 23! CHECK-NEXT: ^bb0(%[[PRIV_ARG:.*]]: [[TYPE:!fir.ref<!fir.box<!fir.heap<i32>>>]], %[[PRIV_ALLOC:.*]]: [[TYPE]]):24 25! CHECK: } copy {26! CHECK: ^bb0(%[[PRIV_ORIG_ARG:.*]]: [[TYPE]], %[[PRIV_PRIV_ARG:.*]]: [[TYPE]]):27 28! CHECK-NEXT:  %[[PRIV_BASE_VAL:.*]] = fir.load %[[PRIV_PRIV_ARG]]29! CHECK-NEXT:  %[[PRIV_BASE_BOX:.*]] = fir.box_addr %[[PRIV_BASE_VAL]]30! CHECK-NEXT:  %[[PRIV_BASE_ADDR:.*]] = fir.convert %[[PRIV_BASE_BOX]]31! CHECK-NEXT:  %[[C0:.*]] = arith.constant 0 : i6432! CHECK-NEXT:  %[[COPY_COND:.*]] = arith.cmpi ne, %[[PRIV_BASE_ADDR]], %[[C0]] : i6433 34! CHECK-NEXT:  fir.if %[[COPY_COND]] {35! CHECK-NEXT:    %[[ORIG_BASE_VAL:.*]] = fir.load %[[PRIV_ORIG_ARG]]36! CHECK-NEXT:    %[[ORIG_BASE_ADDR:.*]] = fir.box_addr %[[ORIG_BASE_VAL]]37! CHECK-NEXT:    %[[ORIG_BASE_LD:.*]] = fir.load %[[ORIG_BASE_ADDR]]38! CHECK-NEXT:    hlfir.assign %[[ORIG_BASE_LD]] to %[[PRIV_PRIV_ARG]] realloc39! CHECK-NEXT:  }40 41! RUN: %flang -c -emit-llvm -fopenmp -mmlir --enable-delayed-privatization \42! RUN:   -o - %t/test_compilation_to_obj.f90 | \43! RUN:   llvm-dis 2>&1 |\44! RUN:   FileCheck %s -check-prefix=LLVM45 46!--- test_compilation_to_obj.f9047 48program compilation_to_obj49  real, allocatable :: t(:)50 51!$omp parallel firstprivate(t)52  t(1) = 3.1453!$omp end parallel54 55end program compilation_to_obj56 57! LLVM: @[[GLOB_VAR:[^[:space:]]+]]t = internal global58 59! LLVM: define internal void @_QQmain..omp_par60! LLVM: call void @llvm.memcpy.p0.p0.i32(ptr %{{.+}}, ptr @[[GLOB_VAR]]t, i32 48, i1 false)61