[flang-commits] [flang] 35c76eb - [flang][OpenMP] Always set "openmp_flags" (#138153)

via flang-commits flang-commits at lists.llvm.org
Thu May 1 10:10:19 PDT 2025


Author: Krzysztof Parzyszek
Date: 2025-05-01T12:10:15-05:00
New Revision: 35c76eb195990865ee63a0aba3c18ad3c4189e73

URL: https://github.com/llvm/llvm-project/commit/35c76eb195990865ee63a0aba3c18ad3c4189e73
DIFF: https://github.com/llvm/llvm-project/commit/35c76eb195990865ee63a0aba3c18ad3c4189e73.diff

LOG: [flang][OpenMP] Always set "openmp_flags" (#138153)

Many OpenMP tests use "%openmp_flags" in the RUN line. In many OpenMP
lit tests this variable is expected to at least have "-fopenmp" in it.
However, in the lit config this variable was only given a value when the
OpenMP runtime build was enabled.

If the runtime build was not enabled, %openmp_flags would expand to an
empty string, and unless a lit test specifically used -fopenmp in the
RUN line, OpenMP would be disabled.

This patch sets %openmp_flags to start with "-fopenmp" regardless of the
build configuration.

Added: 
    

Modified: 
    flang/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index aa27fdc2fe412..7eb57670ac767 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -178,17 +178,15 @@
     config.environment["LIBPGMATH"] = True
 
 # Determine if OpenMP runtime was built (enable OpenMP tests via REQUIRES in test file)
+openmp_flags_substitution = "-fopenmp"
 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 built as a
     # project or runtime.
     if config.openmp_module_dir:
-        config.substitutions.append(
-            ("%openmp_flags", f"-fopenmp -J {config.openmp_module_dir}")
-        )
-    else:
-        config.substitutions.append(("%openmp_flags", "-fopenmp"))
+        openmp_flags_substitution += f" -J {config.openmp_module_dir}"
+config.substitutions.append(("%openmp_flags", openmp_flags_substitution))
 
 # Add features and substitutions to test F128 math support.
 # %f128-lib substitution may be used to generate check prefixes


        


More information about the flang-commits mailing list