84 lines · plain
1! Similar to stack-arrays.f90; i.e. both test the stack-arrays pass for different2! kinds of supported inputs. This one differs in that it takes the hlfir lowering3! path in flag rather than the fir one. For example, temp arrays are lowered4! differently in hlfir vs. fir and the IR that reaches the stack arrays pass looks5! quite different.6 7 8! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - \9! RUN: | fir-opt --lower-hlfir-ordered-assignments \10! RUN: --bufferize-hlfir \11! RUN: --convert-hlfir-to-fir \12! RUN: --array-value-copy \13! RUN: --stack-arrays \14! RUN: | FileCheck %s15 16subroutine temp_array17 implicit none18 integer (8) :: lV19 integer (8), dimension (2) :: iaVS20 21 lV = 20222 23 iaVS = [lV, lV]24end subroutine temp_array25! CHECK-LABEL: func.func @_QPtemp_array{{.*}} {26! CHECK-NOT: fir.allocmem27! CHECK-NOT: fir.freemem28! CHECK: fir.alloca !fir.array<2xi64>29! CHECK-NOT: fir.allocmem30! CHECK-NOT: fir.freemem31! CHECK: return32! CHECK-NEXT: }33 34subroutine omp_temp_array35 implicit none36 integer (8) :: lV37 integer (8), dimension (2) :: iaVS38 39 lV = 20240 41 !$omp target42 iaVS = [lV, lV]43 !$omp end target44end subroutine omp_temp_array45! CHECK-LABEL: func.func @_QPomp_temp_array{{.*}} {46! CHECK: omp.target {{.*}} {47! CHECK-NOT: fir.allocmem48! CHECK-NOT: fir.freemem49! CHECK: fir.alloca !fir.array<2xi64>50! CHECK-NOT: fir.allocmem51! CHECK-NOT: fir.freemem52! CHECK: omp.terminator53! CHECK-NEXT: }54! CHECK: return55! CHECK-NEXT: }56 57subroutine omp_target_wsloop58 implicit none59 integer (8) :: lV, i60 integer (8), dimension (2) :: iaVS61 62 lV = 20263 64 !$omp target teams distribute65 do i = 1, 1066 iaVS = [lV, lV]67 end do68 !$omp end target teams distribute69end subroutine omp_target_wsloop70! CHECK-LABEL: func.func @_QPomp_target_wsloop{{.*}} {71! CHECK: omp.target {{.*}} {72! CHECK-NOT: fir.allocmem73! CHECK-NOT: fir.freemem74! CHECK: omp.teams {75! CHECK: fir.alloca !fir.array<2xi64>76! CHECK: omp.distribute private({{.*}}) {77! CHECK: omp.loop_nest {{.*}} {78! CHECK-NOT: fir.allocmem79! CHECK-NOT: fir.freemem80! CHECK: omp.yield81! CHECK-NEXT: }82! CHECK: return83! CHECK-NEXT: }84