Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang][OpenMP] Re-enable tests when building OpenMP as a runtime #89046

Merged
merged 9 commits into from
May 18, 2024

Conversation

mjklemm
Copy link
Contributor

@mjklemm mjklemm commented Apr 17, 2024

This PR re-enables OpenMP tests when the OpenMP library is configured as a runtime build. After PR #80874 has disabled them for a while.

The test system now has a command substitution that adds "-J" with the proper folder that contains omp_lib.{h,mod} to the Flang compiler command line in a test. This is only done when the OpenMP library is a runtime build (via LLVM_ENABLE_RUNTIMES), but is skipped if the OpenMP library is built as a regular LLVM project (via LLVM_ENABLE_PROJECTS)

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 17, 2024

This PR cannot land before PR #88934 has landed.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 17, 2024

@llvm/pr-subscribers-flang-driver
@llvm/pr-subscribers-flang-parser
@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-fir-hlfir

Author: Michael Klemm (mjklemm)

Changes

This PR re-enables OpenMP tests when the OpenMP library is configured as a runtime build. After PR #80874 has disabled them for a while.

The test system now has a command substitution that adds "-J" with the proper folder that contains omp_lib.{h,mod} to the Flang compiler command line in a test. This is only done when the OpenMP library is a runtime build (via LLVM_ENABLE_RUNTIMES), but is skipped if the OpenMP library is built as a regular LLVM project (via LLVM_ENABLE_PROJECTS)


Patch is 38.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/89046.diff

65 Files Affected:

  • (modified) flang/test/Driver/include-omp-header.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-capture.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-read.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-update.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-write.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/critical.f90 (+3-3)
  • (modified) flang/test/Lower/OpenMP/FIR/parallel-sections.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/parallel.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/sections.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/single.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/task.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/taskgroup.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/teams.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/atomic-capture.f90 (+2-3)
  • (modified) flang/test/Lower/OpenMP/atomic-read.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/atomic-update.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/atomic-write.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/critical.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/omp-lib-num-threads.f90 (+4-4)
  • (modified) flang/test/Lower/OpenMP/parallel-sections.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/parallel.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/sections.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/single.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/task.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/taskgroup.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/teams.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/threadprivate-default-clause.f90 (+1-1)
  • (modified) flang/test/Parser/OpenMP/allocate-tree-spec-part.f90 (+1-1)
  • (modified) flang/test/Parser/OpenMP/allocate-tree.f90 (+2-2)
  • (modified) flang/test/Parser/OpenMP/target_device_parse.f90 (+2-2)
  • (modified) flang/test/Semantics/OpenMP/allocate-clause01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate-directive.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate07.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate08.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate09.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic-hint-clause.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/clause-validity01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/critical-hint-clause.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/declare-target01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/flush02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/parallel-sections01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/resolve06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/sections02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/sync-critical02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/taskgroup01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/threadprivate01.f90 (+1-1)
  • (modified) flang/test/lit.cfg.py (+8)
diff --git a/flang/test/Driver/include-omp-header.f90 b/flang/test/Driver/include-omp-header.f90
index 6ddc6f3da2a455..7745286de0ac5a 100644
--- a/flang/test/Driver/include-omp-header.f90
+++ b/flang/test/Driver/include-omp-header.f90
@@ -9,11 +9,11 @@
 
 ! This should just work
 ! RUN: not rm omp_lib.h
-! RUN: %flang -cpp -fsyntax-only -fopenmp %s  2>&1
+! RUN: %flang -cpp -fsyntax-only -fopenmp %openmp_module_flag %s  2>&1
 
 ! Create an empty omp_lib.h header that _does not_ define omp_default_mem_alloc - this should lead to semantic errors
 ! RUN: touch omp_lib.h
-! RUN: not %flang -cpp -fsyntax-only -fopenmp %s  2>&1 | FileCheck %s
+! RUN: not %flang -cpp -fsyntax-only -fopenmp %openmp_module_flag %s  2>&1 | FileCheck %s
 ! RUN: rm omp_lib.h
 
 ! CHECK: error: Must have INTEGER type, but is REAL(4)
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
index 9b94214b9da8bb..e1bb8abcf88473 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic capture
 
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-read.f90 b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
index 7698c3d7490fe9..3f9f57a448386a 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic read
 
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-update.f90 b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
index ae201807c337f0..e98bdb0d4c1512 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
 ! This test checks lowering of atomic and atomic update constructs
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 program OmpAtomicUpdate
     use omp_lib
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-write.f90 b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
index 142481b7a1d210..5ab630dd64d395 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic write
 
diff --git a/flang/test/Lower/OpenMP/FIR/critical.f90 b/flang/test/Lower/OpenMP/FIR/critical.f90
index fa33fb0fe58bb0..7eb48639296d03 100644
--- a/flang/test/Lower/OpenMP/FIR/critical.f90
+++ b/flang/test/Lower/OpenMP/FIR/critical.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
 
 !OMPDialect: omp.critical.declare @help2
 !OMPDialect: omp.critical.declare @help1 hint(contended)
diff --git a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
index 0c0834cfafe9c3..89452de459e7c4 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion-on-func-opt | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --cfg-conversion-on-func-opt | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
 
 !===============================================================================
 ! Parallel sections construct
diff --git a/flang/test/Lower/OpenMP/FIR/parallel.f90 b/flang/test/Lower/OpenMP/FIR/parallel.f90
index a2ceb2d939f258..2736f18b961879 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect"
 
 !FIRDialect-LABEL: func @_QPparallel_simple
 subroutine parallel_simple()
diff --git a/flang/test/Lower/OpenMP/FIR/sections.f90 b/flang/test/Lower/OpenMP/FIR/sections.f90
index 7b313f3dc0b41f..7b9e75ef6ef7df 100644
--- a/flang/test/Lower/OpenMP/FIR/sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/sections.f90
@@ -2,7 +2,7 @@
 
 ! This test checks the lowering of OpenMP sections construct with several clauses present
 
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
 !CHECK:   %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
diff --git a/flang/test/Lower/OpenMP/FIR/single.f90 b/flang/test/Lower/OpenMP/FIR/single.f90
index 65ae07c2c28431..9005fc66b3f317 100644
--- a/flang/test/Lower/OpenMP/FIR/single.f90
+++ b/flang/test/Lower/OpenMP/FIR/single.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
-!RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+!RUN: bbc -emit-fir -hlfir=false -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Single construct
diff --git a/flang/test/Lower/OpenMP/FIR/task.f90 b/flang/test/Lower/OpenMP/FIR/task.f90
index 012ac757d304a8..f5e2d19b5b3775 100644
--- a/flang/test/Lower/OpenMP/FIR/task.f90
+++ b/flang/test/Lower/OpenMP/FIR/task.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPomp_task_simple() {
 subroutine omp_task_simple
diff --git a/flang/test/Lower/OpenMP/FIR/taskgroup.f90 b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
index 78b9da8e9b0988..83bee89bada3c0 100644
--- a/flang/test/Lower/OpenMP/FIR/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: @_QPomp_taskgroup
 subroutine omp_taskgroup
diff --git a/flang/test/Lower/OpenMP/FIR/teams.f90 b/flang/test/Lower/OpenMP/FIR/teams.f90
index 9c0593a24f2df1..383b5f49bccbbd 100644
--- a/flang/test/Lower/OpenMP/FIR/teams.f90
+++ b/flang/test/Lower/OpenMP/FIR/teams.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPteams_simple
 subroutine teams_simple()
diff --git a/flang/test/Lower/OpenMP/atomic-capture.f90 b/flang/test/Lower/OpenMP/atomic-capture.f90
index 2587c24cedf3b5..5788fe10842ede 100644
--- a/flang/test/Lower/OpenMP/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/atomic-capture.f90
@@ -2,9 +2,8 @@
 
 ! This test checks the lowering of atomic capture
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s 
-
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 
 program OmpAtomicCapture
diff --git a/flang/test/Lower/OpenMP/atomic-read.f90 b/flang/test/Lower/OpenMP/atomic-read.f90
index 366da21f53f8cf..1c054875170cff 100644
--- a/flang/test/Lower/OpenMP/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/atomic-read.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic read
 
diff --git a/flang/test/Lower/OpenMP/atomic-update.f90 b/flang/test/Lower/OpenMP/atomic-update.f90
index 051779e40816fa..892a9699a5d86e 100644
--- a/flang/test/Lower/OpenMP/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/atomic-update.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
 ! This test checks lowering of atomic and atomic update constructs
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 program OmpAtomicUpdate
     use omp_lib
diff --git a/flang/test/Lower/OpenMP/atomic-write.f90 b/flang/test/Lower/OpenMP/atomic-write.f90
index 85955af64bbe28..986f30fae6d910 100644
--- a/flang/test/Lower/OpenMP/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/atomic-write.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic write
 
diff --git a/flang/test/Lower/OpenMP/critical.f90 b/flang/test/Lower/OpenMP/critical.f90
index 38e6d0eac1cbdc..3e8f7f20483efd 100644
--- a/flang/test/Lower/OpenMP/critical.f90
+++ b/flang/test/Lower/OpenMP/critical.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: omp.critical.declare @help2
 !CHECK: omp.critical.declare @help1 hint(contended)
diff --git a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
index d2b558a886ebed..2799e090e2a99b 100644
--- a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
+++ b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
@@ -1,9 +1,9 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
-! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
-! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - 2>&1 | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir -o - %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -fopenmp %openmp_module_flag %s -o - 2>&1 | FileCheck %s
+! RUN: bbc -emit-fir -fopenmp %openmp_module_flag -o - %s 2>&1 | FileCheck %s
 !
 ! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
 ! get lowered even though their implementation is not in the omp_lib module
diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index 2f78dd4562b0ae..9892c1511a46f3 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Parallel sections construct
diff --git a/flang/test/Lower/OpenMP/parallel.f90 b/flang/test/Lower/OpenMP/parallel.f90
index 6c062b706ed431..e6115bfa5f76ea 100644
--- a/flang/test/Lower/OpenMP/parallel.f90
+++ b/flang/test/Lower/OpenMP/parallel.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPparallel_simple
 subroutine parallel_simple()
diff --git a/flang/test/Lower/OpenMP/sections.f90 b/flang/test/Lower/OpenMP/sections.f90
index 018848e635733b..166ddae14ad97e 100644
--- a/flang/test/Lower/OpenMP/sections.f90
+++ b/flang/test/Lower/OpenMP/sections.f90
@@ -2,8 +2,8 @@
 
 ! This test checks the lowering of OpenMP sections construct with several clauses present
 
-! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
-! RUN: bbc -hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+! RUN: bbc -hlfir -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
 !CHECK:   %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
diff --git a/flang/test/Lower/OpenMP/single.f90 b/flang/test/Lower/OpenMP/single.f90
index 10d537a0e18b23..57232e8e08e461 100644
--- a/flang/test/Lower/OpenMP/single.f90
+++ b/flang/test/Lower/OpenMP/single.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
-!RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+!RUN: bbc -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Single construct
diff --git a/flang/test/Lower/OpenMP/task.f90 b/flang/test/Lower/OpenMP/task.f90
index f3718b8829ccaf..222240ade1d1e0 100644
--- a/flang/test/Lower/OpenMP/task.f90
+++ b/flang/test/Lower/OpenMP/task.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPomp_task_simple() {
 subroutine omp_task_simple
diff --git a/flang/test/Lower/OpenMP/taskgroup.f90 b/flang/test/Lower/OpenMP/taskgroup.f90
index 76458f1f1127f3..c70271a27f966f 100644
--- a/flang/test/Lower/OpenMP/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/taskgroup.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: @_QPomp_taskgroup
 subroutine omp_taskgroup
diff --git a/flang/test/Lower/OpenMP/teams.f90 b/flang/test/Lower/OpenMP/teams.f90
index f122a578a6e160..1349e977a1176e 100644
--- a/flang/test/Lower/OpenMP/teams.f90
+++ b/flang/test/Lower/OpenMP/teams.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPteams_simple
 subroutine teams_simple()
diff --git a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90 b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
index 10beaf6fefde7f..7b47c8704436b6 100644
--- a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
+++ b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
@@ -2,7 +2,7 @@
 
 ! Simple test for lowering of OpenMP Threadprivate Directive with HLFIR.
 
-!RUN: %flang_fc1  -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1  -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func.func @_QPsub1() {
 !CHECK:     %[[A:.*]] = fir.address_of(@_QFsub1Ea) : !fir.ref<i32>
diff --git a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90 b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
index ab56b98b5783b3..b5968a63a7a9a7 100644
--- a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-dump-parse-tree %s | FileCheck %s
 ! Ensures associated declarative OMP allocations in the specification
 ! part are kept there
 
diff --git a/flang/test/Parser/OpenMP/allocate-tree.f90 b/flang/test/Parser/OpenMP/allocate-tree.f90
index 02393a536cf477..a1b13111f5b259 100644
--- a/flang/test/Parser/OpenMP/allocate-tree.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
-! RUN: %flang_fc1 -fopenmp -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-dump-parse-tree %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
 ! Ensures associated declarative OMP allocations are nested in their
 ! corresponding executable allocate directive
 
diff --git a/flang/test/Parser/OpenMP/target_device_parse.f90 b/flang/test/Parser/OpenMP/target_device_parse.f90
index dace34b6ec32f6..48cea46f3f74a7 100644
--- a/flang/test/Parser/OpenMP/target_device_parse.f90
+++ b/flang/test/Parser/OpenMP/target_device_parse.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s
-! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
+! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %openmp_module_flag %s | FileCheck --ignore-case %s
+! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %openmp_module_flag %s | FileCheck --check-prefix="PARSE-TREE" %s
 ! Checks the parsing of Openmp 5.0 Target Device constructs
 !
 PROGRAM main
diff --git a/flang/test/Semantics/OpenMP/allocate-clause01.f90 b/flang/test/Semantics/OpenMP/allocate-clause01.f90
index e059a4a61a90f3..580d583319c8e7 100644
--- a/flang/test/Semantics/OpenMP/allocate-clause01.f90
+++ b/flang/test/Semantics/OpenMP/allocate-clause01.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %python %S/../test_errors.py %s ...
[truncated]

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 17, 2024

@llvm/pr-subscribers-flang-semantics

Author: Michael Klemm (mjklemm)

Changes

This PR re-enables OpenMP tests when the OpenMP library is configured as a runtime build. After PR #80874 has disabled them for a while.

The test system now has a command substitution that adds "-J" with the proper folder that contains omp_lib.{h,mod} to the Flang compiler command line in a test. This is only done when the OpenMP library is a runtime build (via LLVM_ENABLE_RUNTIMES), but is skipped if the OpenMP library is built as a regular LLVM project (via LLVM_ENABLE_PROJECTS)


Patch is 38.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/89046.diff

65 Files Affected:

  • (modified) flang/test/Driver/include-omp-header.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-capture.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-read.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-update.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/atomic-write.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/critical.f90 (+3-3)
  • (modified) flang/test/Lower/OpenMP/FIR/parallel-sections.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/parallel.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/sections.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/single.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/FIR/task.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/taskgroup.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/FIR/teams.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/atomic-capture.f90 (+2-3)
  • (modified) flang/test/Lower/OpenMP/atomic-read.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/atomic-update.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/atomic-write.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/critical.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/omp-lib-num-threads.f90 (+4-4)
  • (modified) flang/test/Lower/OpenMP/parallel-sections.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/parallel.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/sections.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/single.f90 (+2-2)
  • (modified) flang/test/Lower/OpenMP/task.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/taskgroup.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/teams.f90 (+1-1)
  • (modified) flang/test/Lower/OpenMP/threadprivate-default-clause.f90 (+1-1)
  • (modified) flang/test/Parser/OpenMP/allocate-tree-spec-part.f90 (+1-1)
  • (modified) flang/test/Parser/OpenMP/allocate-tree.f90 (+2-2)
  • (modified) flang/test/Parser/OpenMP/target_device_parse.f90 (+2-2)
  • (modified) flang/test/Semantics/OpenMP/allocate-clause01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate-directive.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate07.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate08.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocate09.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/allocators06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic-hint-clause.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic03.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic04.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/atomic05.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/clause-validity01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/critical-hint-clause.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/declare-target01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/flush02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/parallel-sections01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/resolve06.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/sections02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/sync-critical02.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/taskgroup01.f90 (+1-1)
  • (modified) flang/test/Semantics/OpenMP/threadprivate01.f90 (+1-1)
  • (modified) flang/test/lit.cfg.py (+8)
diff --git a/flang/test/Driver/include-omp-header.f90 b/flang/test/Driver/include-omp-header.f90
index 6ddc6f3da2a455..7745286de0ac5a 100644
--- a/flang/test/Driver/include-omp-header.f90
+++ b/flang/test/Driver/include-omp-header.f90
@@ -9,11 +9,11 @@
 
 ! This should just work
 ! RUN: not rm omp_lib.h
-! RUN: %flang -cpp -fsyntax-only -fopenmp %s  2>&1
+! RUN: %flang -cpp -fsyntax-only -fopenmp %openmp_module_flag %s  2>&1
 
 ! Create an empty omp_lib.h header that _does not_ define omp_default_mem_alloc - this should lead to semantic errors
 ! RUN: touch omp_lib.h
-! RUN: not %flang -cpp -fsyntax-only -fopenmp %s  2>&1 | FileCheck %s
+! RUN: not %flang -cpp -fsyntax-only -fopenmp %openmp_module_flag %s  2>&1 | FileCheck %s
 ! RUN: rm omp_lib.h
 
 ! CHECK: error: Must have INTEGER type, but is REAL(4)
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90 b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
index 9b94214b9da8bb..e1bb8abcf88473 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-capture.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic capture
 
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-read.f90 b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
index 7698c3d7490fe9..3f9f57a448386a 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-read.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic read
 
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-update.f90 b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
index ae201807c337f0..e98bdb0d4c1512 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-update.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
 ! This test checks lowering of atomic and atomic update constructs
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 program OmpAtomicUpdate
     use omp_lib
diff --git a/flang/test/Lower/OpenMP/FIR/atomic-write.f90 b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
index 142481b7a1d210..5ab630dd64d395 100644
--- a/flang/test/Lower/OpenMP/FIR/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/FIR/atomic-write.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc --use-desc-for-alloc=false -fopenmp %openmp_module_flag -emit-fir -hlfir=false %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic write
 
diff --git a/flang/test/Lower/OpenMP/FIR/critical.f90 b/flang/test/Lower/OpenMP/FIR/critical.f90
index fa33fb0fe58bb0..7eb48639296d03 100644
--- a/flang/test/Lower/OpenMP/FIR/critical.f90
+++ b/flang/test/Lower/OpenMP/FIR/critical.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
 
 !OMPDialect: omp.critical.declare @help2
 !OMPDialect: omp.critical.declare @help1 hint(contended)
diff --git a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90 b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
index 0c0834cfafe9c3..89452de459e7c4 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion-on-func-opt | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --cfg-conversion-on-func-opt | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
 
 !===============================================================================
 ! Parallel sections construct
diff --git a/flang/test/Lower/OpenMP/FIR/parallel.f90 b/flang/test/Lower/OpenMP/FIR/parallel.f90
index a2ceb2d939f258..2736f18b961879 100644
--- a/flang/test/Lower/OpenMP/FIR/parallel.f90
+++ b/flang/test/Lower/OpenMP/FIR/parallel.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMDialect,OMPDialect"
 
 !FIRDialect-LABEL: func @_QPparallel_simple
 subroutine parallel_simple()
diff --git a/flang/test/Lower/OpenMP/FIR/sections.f90 b/flang/test/Lower/OpenMP/FIR/sections.f90
index 7b313f3dc0b41f..7b9e75ef6ef7df 100644
--- a/flang/test/Lower/OpenMP/FIR/sections.f90
+++ b/flang/test/Lower/OpenMP/FIR/sections.f90
@@ -2,7 +2,7 @@
 
 ! This test checks the lowering of OpenMP sections construct with several clauses present
 
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
 !CHECK:   %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
diff --git a/flang/test/Lower/OpenMP/FIR/single.f90 b/flang/test/Lower/OpenMP/FIR/single.f90
index 65ae07c2c28431..9005fc66b3f317 100644
--- a/flang/test/Lower/OpenMP/FIR/single.f90
+++ b/flang/test/Lower/OpenMP/FIR/single.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
-!RUN: bbc -emit-fir -hlfir=false -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+!RUN: bbc -emit-fir -hlfir=false -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Single construct
diff --git a/flang/test/Lower/OpenMP/FIR/task.f90 b/flang/test/Lower/OpenMP/FIR/task.f90
index 012ac757d304a8..f5e2d19b5b3775 100644
--- a/flang/test/Lower/OpenMP/FIR/task.f90
+++ b/flang/test/Lower/OpenMP/FIR/task.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPomp_task_simple() {
 subroutine omp_task_simple
diff --git a/flang/test/Lower/OpenMP/FIR/taskgroup.f90 b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
index 78b9da8e9b0988..83bee89bada3c0 100644
--- a/flang/test/Lower/OpenMP/FIR/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/FIR/taskgroup.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: @_QPomp_taskgroup
 subroutine omp_taskgroup
diff --git a/flang/test/Lower/OpenMP/FIR/teams.f90 b/flang/test/Lower/OpenMP/FIR/teams.f90
index 9c0593a24f2df1..383b5f49bccbbd 100644
--- a/flang/test/Lower/OpenMP/FIR/teams.f90
+++ b/flang/test/Lower/OpenMP/FIR/teams.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPteams_simple
 subroutine teams_simple()
diff --git a/flang/test/Lower/OpenMP/atomic-capture.f90 b/flang/test/Lower/OpenMP/atomic-capture.f90
index 2587c24cedf3b5..5788fe10842ede 100644
--- a/flang/test/Lower/OpenMP/atomic-capture.f90
+++ b/flang/test/Lower/OpenMP/atomic-capture.f90
@@ -2,9 +2,8 @@
 
 ! This test checks the lowering of atomic capture
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s 
-
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 
 program OmpAtomicCapture
diff --git a/flang/test/Lower/OpenMP/atomic-read.f90 b/flang/test/Lower/OpenMP/atomic-read.f90
index 366da21f53f8cf..1c054875170cff 100644
--- a/flang/test/Lower/OpenMP/atomic-read.f90
+++ b/flang/test/Lower/OpenMP/atomic-read.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic read
 
diff --git a/flang/test/Lower/OpenMP/atomic-update.f90 b/flang/test/Lower/OpenMP/atomic-update.f90
index 051779e40816fa..892a9699a5d86e 100644
--- a/flang/test/Lower/OpenMP/atomic-update.f90
+++ b/flang/test/Lower/OpenMP/atomic-update.f90
@@ -1,8 +1,8 @@
 ! REQUIRES: openmp_runtime
 
 ! This test checks lowering of atomic and atomic update constructs
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 program OmpAtomicUpdate
     use omp_lib
diff --git a/flang/test/Lower/OpenMP/atomic-write.f90 b/flang/test/Lower/OpenMP/atomic-write.f90
index 85955af64bbe28..986f30fae6d910 100644
--- a/flang/test/Lower/OpenMP/atomic-write.f90
+++ b/flang/test/Lower/OpenMP/atomic-write.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir %s -o - | FileCheck %s
 
 ! This test checks the lowering of atomic write
 
diff --git a/flang/test/Lower/OpenMP/critical.f90 b/flang/test/Lower/OpenMP/critical.f90
index 38e6d0eac1cbdc..3e8f7f20483efd 100644
--- a/flang/test/Lower/OpenMP/critical.f90
+++ b/flang/test/Lower/OpenMP/critical.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: omp.critical.declare @help2
 !CHECK: omp.critical.declare @help1 hint(contended)
diff --git a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
index d2b558a886ebed..2799e090e2a99b 100644
--- a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
+++ b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
@@ -1,9 +1,9 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
-! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
-! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - 2>&1 | FileCheck %s
+! RUN: bbc -fopenmp %openmp_module_flag -emit-hlfir -o - %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -fopenmp %openmp_module_flag %s -o - 2>&1 | FileCheck %s
+! RUN: bbc -emit-fir -fopenmp %openmp_module_flag -o - %s 2>&1 | FileCheck %s
 !
 ! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
 ! get lowered even though their implementation is not in the omp_lib module
diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index 2f78dd4562b0ae..9892c1511a46f3 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Parallel sections construct
diff --git a/flang/test/Lower/OpenMP/parallel.f90 b/flang/test/Lower/OpenMP/parallel.f90
index 6c062b706ed431..e6115bfa5f76ea 100644
--- a/flang/test/Lower/OpenMP/parallel.f90
+++ b/flang/test/Lower/OpenMP/parallel.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPparallel_simple
 subroutine parallel_simple()
diff --git a/flang/test/Lower/OpenMP/sections.f90 b/flang/test/Lower/OpenMP/sections.f90
index 018848e635733b..166ddae14ad97e 100644
--- a/flang/test/Lower/OpenMP/sections.f90
+++ b/flang/test/Lower/OpenMP/sections.f90
@@ -2,8 +2,8 @@
 
 ! This test checks the lowering of OpenMP sections construct with several clauses present
 
-! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
-! RUN: bbc -hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+! RUN: bbc -hlfir -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
 !CHECK:   %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
diff --git a/flang/test/Lower/OpenMP/single.f90 b/flang/test/Lower/OpenMP/single.f90
index 10d537a0e18b23..57232e8e08e461 100644
--- a/flang/test/Lower/OpenMP/single.f90
+++ b/flang/test/Lower/OpenMP/single.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
-!RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
+!RUN: bbc -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !===============================================================================
 ! Single construct
diff --git a/flang/test/Lower/OpenMP/task.f90 b/flang/test/Lower/OpenMP/task.f90
index f3718b8829ccaf..222240ade1d1e0 100644
--- a/flang/test/Lower/OpenMP/task.f90
+++ b/flang/test/Lower/OpenMP/task.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func @_QPomp_task_simple() {
 subroutine omp_task_simple
diff --git a/flang/test/Lower/OpenMP/taskgroup.f90 b/flang/test/Lower/OpenMP/taskgroup.f90
index 76458f1f1127f3..c70271a27f966f 100644
--- a/flang/test/Lower/OpenMP/taskgroup.f90
+++ b/flang/test/Lower/OpenMP/taskgroup.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: @_QPomp_taskgroup
 subroutine omp_taskgroup
diff --git a/flang/test/Lower/OpenMP/teams.f90 b/flang/test/Lower/OpenMP/teams.f90
index f122a578a6e160..1349e977a1176e 100644
--- a/flang/test/Lower/OpenMP/teams.f90
+++ b/flang/test/Lower/OpenMP/teams.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPteams_simple
 subroutine teams_simple()
diff --git a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90 b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
index 10beaf6fefde7f..7b47c8704436b6 100644
--- a/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
+++ b/flang/test/Lower/OpenMP/threadprivate-default-clause.f90
@@ -2,7 +2,7 @@
 
 ! Simple test for lowering of OpenMP Threadprivate Directive with HLFIR.
 
-!RUN: %flang_fc1  -emit-hlfir -fopenmp %s -o - | FileCheck %s
+!RUN: %flang_fc1  -emit-hlfir -fopenmp %openmp_module_flag %s -o - | FileCheck %s
 
 !CHECK-LABEL: func.func @_QPsub1() {
 !CHECK:     %[[A:.*]] = fir.address_of(@_QFsub1Ea) : !fir.ref<i32>
diff --git a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90 b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
index ab56b98b5783b3..b5968a63a7a9a7 100644
--- a/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-dump-parse-tree %s | FileCheck %s
 ! Ensures associated declarative OMP allocations in the specification
 ! part are kept there
 
diff --git a/flang/test/Parser/OpenMP/allocate-tree.f90 b/flang/test/Parser/OpenMP/allocate-tree.f90
index 02393a536cf477..a1b13111f5b259 100644
--- a/flang/test/Parser/OpenMP/allocate-tree.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
-! RUN: %flang_fc1 -fopenmp -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-dump-parse-tree %s | FileCheck %s
+! RUN: %flang_fc1 -fopenmp %openmp_module_flag -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
 ! Ensures associated declarative OMP allocations are nested in their
 ! corresponding executable allocate directive
 
diff --git a/flang/test/Parser/OpenMP/target_device_parse.f90 b/flang/test/Parser/OpenMP/target_device_parse.f90
index dace34b6ec32f6..48cea46f3f74a7 100644
--- a/flang/test/Parser/OpenMP/target_device_parse.f90
+++ b/flang/test/Parser/OpenMP/target_device_parse.f90
@@ -1,7 +1,7 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s
-! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
+! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %openmp_module_flag %s | FileCheck --ignore-case %s
+! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %openmp_module_flag %s | FileCheck --check-prefix="PARSE-TREE" %s
 ! Checks the parsing of Openmp 5.0 Target Device constructs
 !
 PROGRAM main
diff --git a/flang/test/Semantics/OpenMP/allocate-clause01.f90 b/flang/test/Semantics/OpenMP/allocate-clause01.f90
index e059a4a61a90f3..580d583319c8e7 100644
--- a/flang/test/Semantics/OpenMP/allocate-clause01.f90
+++ b/flang/test/Semantics/OpenMP/allocate-clause01.f90
@@ -1,6 +1,6 @@
 ! REQUIRES: openmp_runtime
 
-! RUN: %python %S/../test_errors.py %s ...
[truncated]

Copy link

github-actions bot commented Apr 17, 2024

✅ With the latest revision this PR passed the Python code formatter.

@banach-space
Copy link
Contributor

Why not update substitutions for %flang_fc1/%bbc etc? This way you could avoid updating so many tests. And RUN lines would be shorter.

I don't have a strong opinion. Thinking out loud - the proposed implementation that even people who don't work on OpenMP will have to remember to add this extra variable to RUN lines. Admittedly, updating %flang_fc1/%bbc` obfuscates things a bit. But that would only affect OpenMP experts?

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 17, 2024

I was playing with the option to extend the extra_args field of ToolSubst. But then, if the OpenMP runtime is enabled, it would inject -J for all tests not only the OpenMP tests. I kind of felt that this was a bit too much. That's why I went with the option of having %openmp_module_flag and putting the burden on the OpenMP tests only. I was hoping that the usual test of creating a new test is by "borrowing" from an existing test and thus automatically getting %openmp_module_flag into the new test.

Other options that I see (happy to get more)

  • Have an extension to Flang to pick up -J and -I from the environment (similar to LIBRARY_PATH or INCLUDE_PATH with C compilers)
  • Change the build system to copy/link/move omp_lib.mod from where it lives for runtime builds to where it lives when doing a project build

@vzakhari
Copy link
Contributor

Just a suggestion: we can combine -J ... and -fopenmp, and name it just %openmp_flag. This will still require changes in all tests, but going forward we can add more things in %openmp_flag, if needed, and all OpenMP tests will use it instead of -fopenmp.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 17, 2024

Just a suggestion: we can combine -J ... and -fopenmp, and name it just %openmp_flag. This will still require changes in all tests, but going forward we can add more things in %openmp_flag, if needed, and all OpenMP tests will use it instead of -fopenmp.

I kind of like that! I'll craft an update tomorrow and post it here. Thanks for the suggestion!

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the update

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that this change only impacts OpenMP tests. This LGTM, thanks!

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 18, 2024

Thanks all for the approval. I will let this PR sit until the dependent PR has been merged. Not sure how long that will take. If it will take too long, I will ask @kparzysz to re-open #88914 and land it.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 30, 2024

Thanks all for the approval. I will let this PR sit until the dependent PR has been merged. Not sure how long that will take. If it will take too long, I will ask @kparzysz to re-open #88914 and land it.

This PR is now ready from my perspective. The depend PR has received mixed feedback and I guess it won't land any time soon, so lets go with the workaround that @kparzysz has proposed and that I have included into this PR now.

@kiranchandramohan
Copy link
Contributor

All the FIR-based tests (eg flang/test/Lower/OpenMP/FIR/teams.f90) are now removed. You might need a rebase.

@mjklemm
Copy link
Contributor Author

mjklemm commented Apr 30, 2024

Not only that... There seem to more changes that broke more than just the removed files. I need to work on this and resolve it. I'll let y'all know when I'm done with it and the PR will be ready again., :-(

@mjklemm mjklemm force-pushed the openmp_runtime_test_support branch from b923e73 to 8c1b0c8 Compare April 30, 2024 16:58
@mjklemm
Copy link
Contributor Author

mjklemm commented May 16, 2024

@kiranchandramohan @banach-space I think this go in now. If you agree, please approve, that I can merge. The conflicts seem easy to resolve, so I'd do this during merge.

EDIT: For some reason, my GitHub does not show the approvals in the summary, but has them in the timeline. Let me know if you're OK to merge this.

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

These tests will fail in the main branch when this PR is being merged.  This is not related to PR.
Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -203,6 +203,15 @@
# Determine if OpenMP runtime was built (enable OpenMP tests via REQUIRES in test file)
if config.have_openmp_rtl:
config.available_features.add("openmp_runtime")
# For the enabled OpenMP tests, add a substitution that is needed in the tests to find
# the omp_lib.{h,mod} files, depending on whether the OpenMP runtime was build as a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build → built

@mjklemm mjklemm merged commit bfeebda into llvm:main May 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants