| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // RUN: %clangxx -c -o %t %s | ||
| // RUN: %llvm_jitlink %t | ||
| // | ||
| // REQUIRES: system-darwin && host-arch-compatible | ||
|
|
||
| static int x = 1; | ||
|
|
||
| class Init { | ||
| public: | ||
| Init() { x = 0; } | ||
| }; | ||
|
|
||
| static Init I; | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| return x; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // REQUIRES: linux | ||
| // | ||
| // Make sure the build-id can be found in both EXEC and DYN (PIE) files, | ||
| // even when the note's section-start is forced to a weird address. | ||
| // (The DYN case would also apply to libraries, not explicitly tested here.) | ||
|
|
||
| // DEFINE: %{cflags} = | ||
| // DEFINE: %{check} = ( \ | ||
| // DEFINE: %clang_profgen -Wl,--build-id -o %t %s %{cflags} && \ | ||
| // DEFINE: env LLVM_PROFILE_FILE=%t.profraw %run %t && \ | ||
| // DEFINE: llvm-readelf --notes %t && \ | ||
| // DEFINE: llvm-profdata show --binary-ids %t.profraw \ | ||
| // DEFINE: ) | FileCheck %s | ||
|
|
||
| // REDEFINE: %{cflags} = -no-pie | ||
| // RUN: %{check} | ||
|
|
||
| // REDEFINE: %{cflags} = -pie -fPIE | ||
| // RUN: %{check} | ||
|
|
||
| // REDEFINE: %{cflags} = -no-pie -Wl,--section-start=.note.gnu.build-id=0x1000000 | ||
| // RUN: %{check} | ||
|
|
||
| // REDEFINE: %{cflags} = -pie -fPIE -Wl,--section-start=.note.gnu.build-id=0x1000000 | ||
| // RUN: %{check} | ||
|
|
||
| // CHECK-LABEL{LITERAL}: .note.gnu.build-id | ||
| // CHECK: Build ID: [[ID:[0-9a-f]+]] | ||
|
|
||
| // CHECK-LABEL{LITERAL}: Binary IDs: | ||
| // CHECK-NEXT: [[ID]] | ||
|
|
||
| int main() { return 0; } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // RUN: fir-opt --simplify-intrinsics %s | FileCheck %s | ||
|
|
||
| func.func @_QPsum_in_device(%arg0: !fir.ref<!fir.array<?xi32>> {cuf.data_attr = #cuf.cuda<device>, fir.bindc_name = "a"}, %arg1: i32 {fir.bindc_name = "n"}) attributes {cuf.proc_attr = #cuf.cuda_proc<global>} { | ||
| %c5_i32 = arith.constant 5 : i32 | ||
| %c1 = arith.constant 1 : index | ||
| %c0 = arith.constant 0 : index | ||
| %c-1 = arith.constant -1 : index | ||
| %0 = fir.dummy_scope : !fir.dscope | ||
| %1 = fir.shape %c-1 : (index) -> !fir.shape<1> | ||
| %2 = fir.declare %arg0(%1) dummy_scope %0 {data_attr = #cuf.cuda<device>, uniq_name = "_QFsum_in_deviceEa"} : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>, !fir.dscope) -> !fir.ref<!fir.array<?xi32>> | ||
| %3 = fir.embox %2(%1) : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xi32>> | ||
| %4 = fir.alloca i32 | ||
| fir.store %arg1 to %4 : !fir.ref<i32> | ||
| %5 = fir.declare %4 dummy_scope %0 {fortran_attrs = #fir.var_attrs<value>, uniq_name = "_QFsum_in_deviceEn"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> | ||
| %12 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsum_in_deviceEi"} | ||
| %13 = fir.declare %12 {uniq_name = "_QFsum_in_deviceEi"} : (!fir.ref<i32>) -> !fir.ref<i32> | ||
| %14 = fir.address_of(@_QM__fortran_builtinsE__builtin_threadidx) : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_dim3{x:i32,y:i32,z:i32}>> | ||
| %18 = fir.load %5 : !fir.ref<i32> | ||
| %19 = fir.convert %18 : (i32) -> index | ||
| %20 = arith.cmpi sgt, %19, %c0 : index | ||
| %21 = arith.select %20, %19, %c0 : index | ||
| %22 = fir.alloca !fir.array<?xi32>, %21 {bindc_name = "auto", uniq_name = "_QFsum_in_deviceEauto"} | ||
| %23 = fir.shape %21 : (index) -> !fir.shape<1> | ||
| %24 = fir.declare %22(%23) {uniq_name = "_QFsum_in_deviceEauto"} : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.ref<!fir.array<?xi32>> | ||
| %25 = fir.embox %24(%23) : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xi32>> | ||
| %26 = fir.undefined index | ||
| %27 = fir.slice %c1, %19, %c1 : (index, index, index) -> !fir.slice<1> | ||
| %28 = fir.embox %24(%23) [%27] : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<?xi32>> | ||
| %29 = fir.absent !fir.box<i1> | ||
| %30 = fir.address_of(@_QQclX91d13f6e74caa2f03965d7a7c6a8fdd5) : !fir.ref<!fir.char<1,50>> | ||
| %31 = fir.convert %28 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none> | ||
| %32 = fir.convert %30 : (!fir.ref<!fir.char<1,50>>) -> !fir.ref<i8> | ||
| %33 = fir.convert %c0 : (index) -> i32 | ||
| %34 = fir.convert %29 : (!fir.box<i1>) -> !fir.box<none> | ||
| %35 = fir.call @_FortranASumInteger4(%31, %32, %c5_i32, %33, %34) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32, i32, !fir.box<none>) -> i32 | ||
| %36 = fir.load %13 : !fir.ref<i32> | ||
| %37 = fir.convert %36 : (i32) -> i64 | ||
| %38 = fir.array_coor %2(%1) %37 : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>, i64) -> !fir.ref<i32> | ||
| fir.store %35 to %38 : !fir.ref<i32> | ||
| return | ||
| } | ||
|
|
||
| // Check that intrinsic simplification is disabled in CUDA Fortran context. The simplified intrinsic is | ||
| // created in the module op but the device func will be migrated into a gpu module op resulting in a | ||
| // missing symbol error. | ||
| // The simplified intrinsic could also be migrated to the gpu module but the choice has not be made | ||
| // at this point. | ||
| // CHECK-LABEL: func.func @_QPsum_in_device | ||
| // CHECK-NOT: fir.call @_FortranASumInteger4x1_contract_simplified |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // RUN: fir-opt --split-input-file --external-name-interop %s | FileCheck %s | ||
|
|
||
| gpu.module @cuda_device_mod { | ||
| gpu.func @_QPfoo() { | ||
| fir.call @_QPthreadfence() fastmath<contract> : () -> () | ||
| gpu.return | ||
| } | ||
| func.func private @_QPthreadfence() attributes {cuf.proc_attr = #cuf.cuda_proc<device>} | ||
| } | ||
|
|
||
| // CHECK-LABEL: gpu.func @_QPfoo | ||
| // CHECK: fir.call @threadfence_() | ||
| // CHECK: func.func private @threadfence_() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // RUN: fir-opt --bufferize-hlfir %s | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: func.func @simple( | ||
| // CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<42xi32>>) { | ||
| // CHECK: omp.parallel { | ||
| // CHECK: omp.workshare { | ||
| // CHECK: %[[VAL_1:.*]] = arith.constant 42 : index | ||
| // CHECK: %[[VAL_2:.*]] = arith.constant 1 : i32 | ||
| // CHECK: %[[VAL_3:.*]] = fir.shape %[[VAL_1]] : (index) -> !fir.shape<1> | ||
| // CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_3]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| // CHECK: %[[VAL_5:.*]] = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} | ||
| // CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]](%[[VAL_3]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) | ||
| // CHECK: %[[VAL_7:.*]] = arith.constant true | ||
| // CHECK: %[[VAL_8:.*]] = arith.constant 1 : index | ||
| // CHECK: omp.workshare.loop_wrapper { | ||
| // CHECK: omp.loop_nest (%[[VAL_9:.*]]) : index = (%[[VAL_8]]) to (%[[VAL_1]]) inclusive step (%[[VAL_8]]) { | ||
| // CHECK: %[[VAL_10:.*]] = hlfir.designate %[[VAL_4]]#0 (%[[VAL_9]]) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> | ||
| // CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_10]] : !fir.ref<i32> | ||
| // CHECK: %[[VAL_12:.*]] = arith.subi %[[VAL_11]], %[[VAL_2]] : i32 | ||
| // CHECK: %[[VAL_13:.*]] = hlfir.designate %[[VAL_6]]#0 (%[[VAL_9]]) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> | ||
| // CHECK: hlfir.assign %[[VAL_12]] to %[[VAL_13]] temporary_lhs : i32, !fir.ref<i32> | ||
| // CHECK: omp.yield | ||
| // CHECK: } | ||
| // CHECK: } | ||
| // CHECK: %[[VAL_14:.*]] = fir.undefined tuple<!fir.heap<!fir.array<42xi32>>, i1> | ||
| // CHECK: %[[VAL_15:.*]] = fir.insert_value %[[VAL_14]], %[[VAL_7]], [1 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, i1) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> | ||
| // CHECK: %[[VAL_16:.*]] = fir.insert_value %[[VAL_15]], %[[VAL_6]]#0, [0 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, !fir.heap<!fir.array<42xi32>>) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> | ||
| // CHECK: hlfir.assign %[[VAL_6]]#0 to %[[VAL_4]]#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> | ||
| // CHECK: fir.freemem %[[VAL_6]]#0 : !fir.heap<!fir.array<42xi32>> | ||
| // CHECK: omp.terminator | ||
| // CHECK: } | ||
| // CHECK: omp.terminator | ||
| // CHECK: } | ||
| // CHECK: return | ||
| // CHECK: } | ||
| func.func @simple(%arg: !fir.ref<!fir.array<42xi32>>) { | ||
| omp.parallel { | ||
| omp.workshare { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| %ref = hlfir.designate %array#0 (%i) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> | ||
| %val = fir.load %ref : !fir.ref<i32> | ||
| %sub = arith.subi %val, %c1_i32 : i32 | ||
| hlfir.yield_element %sub : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| !===----------------------------------------------------------------------===! | ||
| ! This directory can be used to add Integration tests involving multiple | ||
| ! stages of the compiler (for eg. from Fortran to LLVM IR). It should not | ||
| ! contain executable tests. We should only add tests here sparingly and only | ||
| ! if there is no other way to test. Repeat this message in each test that is | ||
| ! added to this directory and sub-directories. | ||
| !===----------------------------------------------------------------------===! | ||
|
|
||
| !RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR | ||
| !RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR | ||
|
|
||
| subroutine sb1(x, y) | ||
| integer :: x(:) | ||
| integer :: y(:) | ||
| !$omp parallel workshare | ||
| x = y | ||
| !$omp end parallel workshare | ||
| end subroutine | ||
|
|
||
| ! HLFIR: omp.parallel { | ||
| ! HLFIR: omp.workshare { | ||
| ! HLFIR: hlfir.assign | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
|
|
||
| ! FIR: omp.parallel { | ||
| ! FIR: omp.wsloop nowait { | ||
| ! FIR: omp.loop_nest | ||
| ! FIR: } | ||
| ! FIR: omp.barrier | ||
| ! FIR: omp.terminator | ||
| ! FIR: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| !===----------------------------------------------------------------------===! | ||
| ! This directory can be used to add Integration tests involving multiple | ||
| ! stages of the compiler (for eg. from Fortran to LLVM IR). It should not | ||
| ! contain executable tests. We should only add tests here sparingly and only | ||
| ! if there is no other way to test. Repeat this message in each test that is | ||
| ! added to this directory and sub-directories. | ||
| !===----------------------------------------------------------------------===! | ||
|
|
||
| !RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR | ||
| !RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR | ||
|
|
||
| subroutine sb1(a, x, y, z) | ||
| integer :: a | ||
| integer :: x(:) | ||
| integer :: y(:) | ||
| integer :: z(:) | ||
| !$omp parallel workshare | ||
| z = a * x + y | ||
| !$omp end parallel workshare | ||
| end subroutine | ||
|
|
||
| ! HLFIR: func.func @_QPsb1 | ||
| ! HLFIR: omp.parallel { | ||
| ! HLFIR: omp.workshare { | ||
| ! HLFIR: hlfir.elemental {{.*}} unordered : (!fir.shape<1>) -> !hlfir.expr<?xi32> { | ||
| ! HLFIR: hlfir.elemental {{.*}} unordered : (!fir.shape<1>) -> !hlfir.expr<?xi32> { | ||
| ! HLFIR: hlfir.assign | ||
| ! HLFIR: hlfir.destroy | ||
| ! HLFIR: hlfir.destroy | ||
| ! HLFIR-NOT: omp.barrier | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
| ! HLFIR-NOT: omp.barrier | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
| ! HLFIR: return | ||
| ! HLFIR: } | ||
| ! HLFIR:} | ||
|
|
||
|
|
||
| ! FIR: func.func private @_workshare_copy_heap_Uxi32(%{{[a-z0-9]+}}: !fir.ref<!fir.heap<!fir.array<?xi32>>>, %{{[a-z0-9]+}}: !fir.ref<!fir.heap<!fir.array<?xi32>>> | ||
| ! FIR: func.func private @_workshare_copy_i32(%{{[a-z0-9]+}}: !fir.ref<i32>, %{{[a-z0-9]+}}: !fir.ref<i32> | ||
|
|
||
| ! FIR: func.func @_QPsb1 | ||
| ! FIR: omp.parallel { | ||
| ! FIR: omp.single copyprivate(%9 -> @_workshare_copy_i32 : !fir.ref<i32>, %10 -> @_workshare_copy_heap_Uxi32 : !fir.ref<!fir.heap<!fir.array<?xi32>>>) { | ||
| ! FIR: fir.allocmem | ||
| ! FIR: omp.wsloop { | ||
| ! FIR: omp.loop_nest | ||
| ! FIR: omp.single nowait { | ||
| ! FIR: fir.call @_FortranAAssign | ||
| ! FIR: fir.freemem | ||
| ! FIR: omp.terminator | ||
| ! FIR: } | ||
| ! FIR: omp.barrier | ||
| ! FIR: omp.terminator | ||
| ! FIR: } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| !===----------------------------------------------------------------------===! | ||
| ! This directory can be used to add Integration tests involving multiple | ||
| ! stages of the compiler (for eg. from Fortran to LLVM IR). It should not | ||
| ! contain executable tests. We should only add tests here sparingly and only | ||
| ! if there is no other way to test. Repeat this message in each test that is | ||
| ! added to this directory and sub-directories. | ||
| !===----------------------------------------------------------------------===! | ||
|
|
||
| !RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR | ||
| !RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR | ||
|
|
||
| subroutine sb1(a, x) | ||
| integer :: a | ||
| integer :: x(:) | ||
| !$omp parallel workshare | ||
| x = a | ||
| !$omp end parallel workshare | ||
| end subroutine | ||
|
|
||
| ! HLFIR: omp.parallel { | ||
| ! HLFIR: omp.workshare { | ||
| ! HLFIR: %[[SCALAR:.*]] = fir.load %1#0 : !fir.ref<i32> | ||
| ! HLFIR: hlfir.assign %[[SCALAR]] to | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
| ! HLFIR: omp.terminator | ||
| ! HLFIR: } | ||
|
|
||
| ! FIR: omp.parallel { | ||
| ! FIR: %[[SCALAR_ALLOCA:.*]] = fir.alloca i32 | ||
| ! FIR: omp.single copyprivate(%[[SCALAR_ALLOCA]] -> @_workshare_copy_i32 : !fir.ref<i32>) { | ||
| ! FIR: %[[SCALAR_LOAD:.*]] = fir.load %{{.*}} : !fir.ref<i32> | ||
| ! FIR: fir.store %[[SCALAR_LOAD]] to %[[SCALAR_ALLOCA]] : !fir.ref<i32> | ||
| ! FIR: omp.terminator | ||
| ! FIR: } | ||
| ! FIR: %[[SCALAR_RELOAD:.*]] = fir.load %[[SCALAR_ALLOCA]] : !fir.ref<i32> | ||
| ! FIR: %6:3 = fir.box_dims %3, %c0 : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index) | ||
| ! FIR: omp.wsloop nowait { | ||
| ! FIR: omp.loop_nest (%arg2) : index = (%c1) to (%6#1) inclusive step (%c1) { | ||
| ! FIR: fir.store %[[SCALAR_RELOAD]] | ||
| ! FIR: omp.yield | ||
| ! FIR: } | ||
| ! FIR: } | ||
| ! FIR: omp.barrier | ||
| ! FIR: omp.terminator |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| !===----------------------------------------------------------------------===! | ||
| ! This directory can be used to add Integration tests involving multiple | ||
| ! stages of the compiler (for eg. from Fortran to LLVM IR). It should not | ||
| ! contain executable tests. We should only add tests here sparingly and only | ||
| ! if there is no other way to test. Repeat this message in each test that is | ||
| ! added to this directory and sub-directories. | ||
| !===----------------------------------------------------------------------===! | ||
|
|
||
| !RUN: %flang_fc1 -emit-hlfir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix HLFIR-O3 | ||
| !RUN: %flang_fc1 -emit-fir -fopenmp -O3 %s -o - | FileCheck %s --check-prefix FIR-O3 | ||
|
|
||
| !RUN: %flang_fc1 -emit-hlfir -fopenmp -O0 %s -o - | FileCheck %s --check-prefix HLFIR-O0 | ||
| !RUN: %flang_fc1 -emit-fir -fopenmp -O0 %s -o - | FileCheck %s --check-prefix FIR-O0 | ||
|
|
||
| program test | ||
| real :: arr_01(10) | ||
| !$omp parallel workshare | ||
| arr_01 = arr_01*2 | ||
| !$omp end parallel workshare | ||
| end program | ||
|
|
||
| ! HLFIR-O3: omp.parallel { | ||
| ! HLFIR-O3: omp.workshare { | ||
| ! HLFIR-O3: hlfir.elemental | ||
| ! HLFIR-O3: hlfir.assign | ||
| ! HLFIR-O3: hlfir.destroy | ||
| ! HLFIR-O3: omp.terminator | ||
| ! HLFIR-O3: omp.terminator | ||
|
|
||
| ! FIR-O3: omp.parallel { | ||
| ! FIR-O3: omp.wsloop nowait { | ||
| ! FIR-O3: omp.loop_nest | ||
| ! FIR-O3: omp.barrier | ||
| ! FIR-O3: omp.terminator | ||
|
|
||
| ! HLFIR-O0: omp.parallel { | ||
| ! HLFIR-O0: omp.workshare { | ||
| ! HLFIR-O0: hlfir.elemental | ||
| ! HLFIR-O0: hlfir.assign | ||
| ! HLFIR-O0: hlfir.destroy | ||
| ! HLFIR-O0: omp.terminator | ||
| ! HLFIR-O0: omp.terminator | ||
|
|
||
| ! Check the copyprivate copy function | ||
| ! FIR-O0: func.func private @_workshare_copy_heap_{{.*}}(%[[DST:.*]]: {{.*}}, %[[SRC:.*]]: {{.*}}) | ||
| ! FIR-O0: fir.load %[[SRC]] | ||
| ! FIR-O0: fir.store {{.*}} to %[[DST]] | ||
|
|
||
| ! Check that we properly handle the temporary array | ||
| ! FIR-O0: omp.parallel { | ||
| ! FIR-O0: %[[CP:.*]] = fir.alloca !fir.heap<!fir.array<10xf32>> | ||
| ! FIR-O0: omp.single copyprivate(%[[CP]] -> @_workshare_copy_heap_ | ||
| ! FIR-O0: fir.allocmem | ||
| ! FIR-O0: fir.store | ||
| ! FIR-O0: omp.terminator | ||
| ! FIR-O0: fir.load %[[CP]] | ||
| ! FIR-O0: omp.wsloop { | ||
| ! FIR-O0: omp.loop_nest | ||
| ! FIR-O0: omp.yield | ||
| ! FIR-O0: omp.single nowait { | ||
| ! FIR-O0: fir.call @_FortranAAssign | ||
| ! FIR-O0: fir.freemem | ||
| ! FIR-O0: omp.terminator | ||
| ! FIR-O0: omp.barrier | ||
| ! FIR-O0: omp.terminator |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s | ||
| ! CHECK: error: expected ':' | ||
| ! CHECK: in the context: loop control | ||
| do concurrent(I = 1, N) | ||
| end do | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| !RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s | ||
| #define e eeeee | ||
| module m | ||
| interface operator(.e.) | ||
| module procedure ir,rr | ||
| end interface operator(.e.) | ||
| contains | ||
| function ir(k1,k2) | ||
| intent(in)::k1,k2 | ||
| ir=k1+k2 | ||
| end function ir | ||
| function rr(k1,k2) | ||
| real,intent(in)::k1,k2 | ||
| rr=k1+k2 | ||
| end function rr | ||
| end module m | ||
| program main | ||
| use m | ||
| !CHECK: IF (real((ir(1_4,5_4)),kind=4)/=6._4) ERROR STOP 1_4 | ||
| !CHECK: IF ((rr(1._4,5.e-1_4))/=1.5_4) ERROR STOP 2_4 | ||
| if((1.e.5)/=6.e0) error stop 1 | ||
| if((1..e..5)/=1.5) error stop 2 | ||
| print *,'pass' | ||
| end program main |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ! RUN: %flang -E %s 2>&1 | FileCheck %s | ||
| ! CHECK-NOT: Character in fixed-form label field must be a digit | ||
| #define KWM ! | ||
| KWM a comment | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| // RUN: fir-opt --bufferize-hlfir %s | FileCheck %s | ||
|
|
||
| // Checks that we correctly identify when to use the lowering to | ||
| // omp.workshare.loop_wrapper | ||
|
|
||
| // CHECK-LABEL: @should_parallelize_0 | ||
| // CHECK: omp.workshare.loop_wrapper | ||
| func.func @should_parallelize_0(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: @should_parallelize_1 | ||
| // CHECK: omp.workshare.loop_wrapper | ||
| func.func @should_parallelize_1(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.parallel { | ||
| omp.workshare { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
|
|
||
| // CHECK-LABEL: @should_not_parallelize_0 | ||
| // CHECK-NOT: omp.workshare.loop_wrapper | ||
| func.func @should_not_parallelize_0(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| omp.single { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: @should_not_parallelize_1 | ||
| // CHECK-NOT: omp.workshare.loop_wrapper | ||
| func.func @should_not_parallelize_1(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| omp.critical { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: @should_not_parallelize_2 | ||
| // CHECK-NOT: omp.workshare.loop_wrapper | ||
| func.func @should_not_parallelize_2(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| omp.parallel { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: @should_not_parallelize_3 | ||
| // CHECK-NOT: omp.workshare.loop_wrapper | ||
| func.func @should_not_parallelize_3(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| omp.parallel { | ||
| omp.workshare { | ||
| omp.parallel { | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| omp.terminator | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: @should_not_parallelize_4 | ||
| // CHECK-NOT: omp.workshare.loop_wrapper | ||
| func.func @should_not_parallelize_4(%arg: !fir.ref<!fir.array<42xi32>>, %idx : index) { | ||
| omp.workshare { | ||
| ^bb1: | ||
| %c42 = arith.constant 42 : index | ||
| %c1_i32 = arith.constant 1 : i32 | ||
| %shape = fir.shape %c42 : (index) -> !fir.shape<1> | ||
| %array:2 = hlfir.declare %arg(%shape) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) | ||
| %elemental = hlfir.elemental %shape unordered : (!fir.shape<1>) -> !hlfir.expr<42xi32> { | ||
| ^bb0(%i: index): | ||
| hlfir.yield_element %c1_i32 : i32 | ||
| } | ||
| hlfir.assign %elemental to %array#0 : !hlfir.expr<42xi32>, !fir.ref<!fir.array<42xi32>> | ||
| hlfir.destroy %elemental : !hlfir.expr<42xi32> | ||
| cf.br ^bb2 | ||
| ^bb2: | ||
| omp.terminator | ||
| } | ||
| return | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,8 @@ | |
|
|
||
| // <semaphore> | ||
|
|
||
| #include <cstddef> | ||
| #include <semaphore> | ||
|
|
||
| int main(int, char**) | ||
| { | ||
|
|
||