[llvm-branch-commits] [flang] [Flang] Optionally do not compile the runtime in-tree (PR #122336)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jan 11 13:11:30 PST 2025


https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/122336

>From dd3ac2e6d8d8d57cd639c25bea3b8d5c99a2f81e Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Thu, 9 Jan 2025 15:58:48 +0100
Subject: [PATCH 1/7] Introduce FLANG_INCLUDE_RUNTIME

---
 flang/CMakeLists.txt                    |  7 +++-
 flang/test/CMakeLists.txt               |  6 +++-
 flang/test/Driver/ctofortran.f90        |  1 +
 flang/test/Driver/exec.f90              |  1 +
 flang/test/Runtime/no-cpp-dep.c         |  2 +-
 flang/test/lit.cfg.py                   |  5 ++-
 flang/test/lit.site.cfg.py.in           |  1 +
 flang/tools/f18/CMakeLists.txt          |  4 +--
 flang/unittests/CMakeLists.txt          |  6 ++--
 flang/unittests/Evaluate/CMakeLists.txt | 46 ++++++++++++++-----------
 10 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 68947eaa9c9bd7..69e963a43d0b97 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -233,6 +233,9 @@ else()
   include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
 endif()
 
+option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" ON)
+pythonize_bool(FLANG_INCLUDE_RUNTIME)
+
 set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
     "Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
 mark_as_advanced(FLANG_TOOLS_INSTALL_DIR)
@@ -473,7 +476,9 @@ if (FLANG_CUF_RUNTIME)
   find_package(CUDAToolkit REQUIRED)
 endif()
 
-add_subdirectory(runtime)
+if (FLANG_INCLUDE_RUNTIME)
+  add_subdirectory(runtime)
+endif ()
 
 if (LLVM_INCLUDE_EXAMPLES)
   add_subdirectory(examples)
diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index cab214c2ef4c8c..e398e0786147aa 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -71,9 +71,13 @@ set(FLANG_TEST_DEPENDS
   llvm-objdump
   llvm-readobj
   split-file
-  FortranRuntime
   FortranDecimal
 )
+
+if (FLANG_INCLUDE_RUNTIME)
+  list(APPEND FLANG_TEST_DEPENDS FortranRuntime)
+endif ()
+
 if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
   list(APPEND FLANG_TEST_DEPENDS Bye)
 endif()
diff --git a/flang/test/Driver/ctofortran.f90 b/flang/test/Driver/ctofortran.f90
index 78eac32133b18e..10c7adaccc9588 100644
--- a/flang/test/Driver/ctofortran.f90
+++ b/flang/test/Driver/ctofortran.f90
@@ -1,4 +1,5 @@
 ! UNSUPPORTED: system-windows
+! REQUIRES: flang-rt
 ! RUN: split-file %s %t
 ! RUN: chmod +x %t/runtest.sh
 ! RUN: %t/runtest.sh %t %t/ffile.f90 %t/cfile.c %flang | FileCheck %s
diff --git a/flang/test/Driver/exec.f90 b/flang/test/Driver/exec.f90
index fd174005ddf62a..9ca91ee24011c9 100644
--- a/flang/test/Driver/exec.f90
+++ b/flang/test/Driver/exec.f90
@@ -1,4 +1,5 @@
 ! UNSUPPORTED: system-windows
+! REQUIRES: flang-rt
 ! Verify that flang can correctly build executables.
 
 ! RUN: %flang %s -o %t
diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c
index b1a5fa004014cc..7303ce63fdec41 100644
--- a/flang/test/Runtime/no-cpp-dep.c
+++ b/flang/test/Runtime/no-cpp-dep.c
@@ -3,7 +3,7 @@ This test makes sure that flang's runtime does not depend on the C++ runtime
 library. It tries to link this simple file against libFortranRuntime.a with
 a C compiler.
 
-REQUIRES: c-compiler
+REQUIRES: c-compiler, flang-rt
 
 RUN: %if system-aix %{ export OBJECT_MODE=64 %}
 RUN: %cc -std=c99 %s -I%include %libruntime -lm  \
diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index c452b6d231c89f..78378bf5f413e8 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -163,10 +163,13 @@
         ToolSubst("%not_todo_abort_cmd", command=FindTool("not"), unresolved="fatal")
     )
 
+if config.flang_include_runtime:
+  config.available_features.add("flang-rt")
+
 # Define some variables to help us test that the flang runtime doesn't depend on
 # the C++ runtime libraries. For this we need a C compiler. If for some reason
 # we don't have one, we can just disable the test.
-if config.cc:
+if config.flang_include_runtime and config.cc:
     libruntime = os.path.join(config.flang_lib_dir, "libFortranRuntime.a")
     include = os.path.join(config.flang_src_dir, "include")
 
diff --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in
index d1a0ac763cf8a0..19f9330f93ae14 100644
--- a/flang/test/lit.site.cfg.py.in
+++ b/flang/test/lit.site.cfg.py.in
@@ -32,6 +32,7 @@ else:
     config.openmp_module_dir = None
 config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@"
 config.have_ldbl_mant_dig_113 = "@HAVE_LDBL_MANT_DIG_113@"
+config.flang_include_runtime = @FLANG_INCLUDE_RUNTIME@
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 4362fcf0537616..022c346aabdbde 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -72,7 +72,7 @@ if (NOT CMAKE_CROSSCOMPILING)
       set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__cuda_builtins.mod)
     else()
       set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
-      if(${filename} STREQUAL "iso_fortran_env")
+      if(${filename} STREQUAL "iso_fortran_env" AND FLANG_INCLUDE_RUNTIME)
         set(depends ${depends} ${FLANG_INTRINSIC_MODULES_DIR}/iso_fortran_env_impl.mod)
       endif()
       if(${filename} STREQUAL "ieee_arithmetic" OR
@@ -105,7 +105,7 @@ if (NOT CMAKE_CROSSCOMPILING)
     set(compile_with "-fsyntax-only")
     set(object_output "")
     set(include_in_link FALSE)
-    if(${filename} IN_LIST MODULES_WITH_IMPLEMENTATION)
+    if(${filename} IN_LIST MODULES_WITH_IMPLEMENTATION AND FORTRAN_INCLUDE_RUNTIME)
       set(object_output "${CMAKE_CURRENT_BINARY_DIR}/${filename}${CMAKE_CXX_OUTPUT_EXTENSION}")
       set(compile_with -c -o ${object_output})
       set(include_in_link TRUE)
diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index 945067fed4f82d..3b8891e22151df 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -24,7 +24,7 @@ function(add_flang_unittest_offload_properties target)
   # FIXME: replace 'native' in --offload-arch option with the list
   #        of targets that Fortran Runtime was built for.
   #        Common code must be moved from flang/runtime/CMakeLists.txt.
-  if (NOT FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD STREQUAL "off")
+  if (FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD)
     set_target_properties(${target}
       PROPERTIES LINK_OPTIONS
       "-fopenmp;--offload-arch=native"
@@ -75,5 +75,7 @@ add_subdirectory(Optimizer)
 add_subdirectory(Common)
 add_subdirectory(Decimal)
 add_subdirectory(Evaluate)
-add_subdirectory(Runtime)
+if (FLANG_INCLUDE_RUNTIME)
+  add_subdirectory(Runtime)
+endif ()
 add_subdirectory(Frontend)
diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt
index 8111ecd72cfc7d..8a12152279ac6c 100644
--- a/flang/unittests/Evaluate/CMakeLists.txt
+++ b/flang/unittests/Evaluate/CMakeLists.txt
@@ -26,15 +26,17 @@ add_flang_nongtest_unittest(integer
   FortranSemantics
 )
 
-add_flang_nongtest_unittest(intrinsics
-  FortranSupport
-  NonGTestTesting
-  FortranEvaluate
-  FortranDecimal
-  FortranSemantics
-  FortranParser
-  FortranRuntime
-)
+if (FLANG_INCLUDE_RUNTIME)
+  add_flang_nongtest_unittest(intrinsics
+    FortranSupport
+    NonGTestTesting
+    FortranEvaluate
+    FortranDecimal
+    FortranSemantics
+    FortranParser
+    FortranRuntime
+  )
+endif ()
 
 add_flang_nongtest_unittest(logical
   NonGTestTesting
@@ -56,19 +58,21 @@ add_flang_nongtest_unittest(real
 )
 llvm_update_compile_flags(real.test)
 
-add_flang_nongtest_unittest(reshape
-  NonGTestTesting
-  FortranSemantics
-  FortranEvaluate
-  FortranRuntime
-)
+if (FLANG_INCLUDE_RUNTIME)
+  add_flang_nongtest_unittest(reshape
+    NonGTestTesting
+    FortranSemantics
+    FortranEvaluate
+    FortranRuntime
+  )
 
-add_flang_nongtest_unittest(ISO-Fortran-binding
-  NonGTestTesting
-  FortranEvaluate
-  FortranSemantics
-  FortranRuntime
-)
+  add_flang_nongtest_unittest(ISO-Fortran-binding
+    NonGTestTesting
+    FortranEvaluate
+    FortranSemantics
+    FortranRuntime
+  )
+endif ()
 
 add_flang_nongtest_unittest(folding
   FortranSupport

>From 32c3edc119d524f1af4987293b727a5998dbacc9 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Thu, 9 Jan 2025 16:23:09 +0100
Subject: [PATCH 2/7] unittest intrinsics does not use runtime

---
 flang/unittests/Evaluate/CMakeLists.txt | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt
index 8a12152279ac6c..1c3fac29cd2982 100644
--- a/flang/unittests/Evaluate/CMakeLists.txt
+++ b/flang/unittests/Evaluate/CMakeLists.txt
@@ -26,17 +26,14 @@ add_flang_nongtest_unittest(integer
   FortranSemantics
 )
 
-if (FLANG_INCLUDE_RUNTIME)
-  add_flang_nongtest_unittest(intrinsics
-    FortranSupport
-    NonGTestTesting
-    FortranEvaluate
-    FortranDecimal
-    FortranSemantics
-    FortranParser
-    FortranRuntime
-  )
-endif ()
+add_flang_nongtest_unittest(intrinsics
+  FortranSupport
+  NonGTestTesting
+  FortranEvaluate
+  FortranDecimal
+  FortranSemantics
+  FortranParser
+)
 
 add_flang_nongtest_unittest(logical
   NonGTestTesting

>From 582045951e7edaba35e8c6966fa40101f8d54ad9 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Thu, 9 Jan 2025 19:30:30 +0100
Subject: [PATCH 3/7] CMake pythonize_bool macro not always available

---
 flang/CMakeLists.txt          | 1 -
 flang/test/lit.site.cfg.py.in | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 69e963a43d0b97..d5f2602334b19e 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -234,7 +234,6 @@ else()
 endif()
 
 option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" ON)
-pythonize_bool(FLANG_INCLUDE_RUNTIME)
 
 set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
     "Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
diff --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in
index 19f9330f93ae14..697ba3fa797633 100644
--- a/flang/test/lit.site.cfg.py.in
+++ b/flang/test/lit.site.cfg.py.in
@@ -1,6 +1,7 @@
 @LIT_SITE_CFG_IN_HEADER@
 
 import sys
+import lit.util
 
 config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
 config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@"))
@@ -32,7 +33,7 @@ else:
     config.openmp_module_dir = None
 config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@"
 config.have_ldbl_mant_dig_113 = "@HAVE_LDBL_MANT_DIG_113@"
-config.flang_include_runtime = @FLANG_INCLUDE_RUNTIME@
+config.flang_include_runtime = lit.util.pythonize_bool("@FLANG_INCLUDE_RUNTIME@")
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)

>From 5a8fce2dfc31e05ace2d0c83ea3dc5d0af0827d3 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Fri, 10 Jan 2025 01:58:20 +0100
Subject: [PATCH 4/7] FORTRAN_INCLUDE_RUNTIME -> FLANG_INCLUDE_RUNTIME

---
 flang/tools/f18/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 022c346aabdbde..e22a12c4ff0742 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -105,7 +105,7 @@ if (NOT CMAKE_CROSSCOMPILING)
     set(compile_with "-fsyntax-only")
     set(object_output "")
     set(include_in_link FALSE)
-    if(${filename} IN_LIST MODULES_WITH_IMPLEMENTATION AND FORTRAN_INCLUDE_RUNTIME)
+    if(${filename} IN_LIST MODULES_WITH_IMPLEMENTATION AND FLANG_INCLUDE_RUNTIME)
       set(object_output "${CMAKE_CURRENT_BINARY_DIR}/${filename}${CMAKE_CXX_OUTPUT_EXTENSION}")
       set(compile_with -c -o ${object_output})
       set(include_in_link TRUE)

>From 24b9bbc23a961a34749fe86bac37efbe31a86797 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Fri, 10 Jan 2025 03:25:47 +0100
Subject: [PATCH 5/7] Apply suggested Python formatting

---
 flang/test/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 78378bf5f413e8..f4580afc8c47b1 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -164,7 +164,7 @@
     )
 
 if config.flang_include_runtime:
-  config.available_features.add("flang-rt")
+    config.available_features.add("flang-rt")
 
 # Define some variables to help us test that the flang runtime doesn't depend on
 # the C++ runtime libraries. For this we need a C compiler. If for some reason

>From 64b6b420048d1f48b203f0290693f3337f4ce8f5 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Fri, 10 Jan 2025 14:14:31 +0100
Subject: [PATCH 6/7] Reduce change noise

---
 flang/include/flang/Runtime/allocatable.h     | 5 +----
 flang/include/flang/Runtime/io-api.h          | 2 +-
 flang/include/flang/Runtime/pointer.h         | 8 ++------
 flang/include/flang/Semantics/semantics.h     | 1 -
 flang/lib/Optimizer/Dialect/FIRType.cpp       | 2 +-
 flang/lib/Support/CMakeLists.txt              | 5 ++---
 flang/runtime/CUDA/allocatable.cpp            | 1 -
 flang/unittests/Runtime/CUDA/Allocatable.cpp  | 2 --
 flang/unittests/Runtime/CUDA/AllocatorCUF.cpp | 2 --
 9 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/flang/include/flang/Runtime/allocatable.h b/flang/include/flang/Runtime/allocatable.h
index 480e987ed5ec6b..58061d9862095e 100644
--- a/flang/include/flang/Runtime/allocatable.h
+++ b/flang/include/flang/Runtime/allocatable.h
@@ -11,13 +11,10 @@
 #ifndef FORTRAN_RUNTIME_ALLOCATABLE_H_
 #define FORTRAN_RUNTIME_ALLOCATABLE_H_
 
-#include "flang/Common/Fortran-consts.h"
-#include "flang/Runtime/descriptor-consts.h"
+#include "flang/Runtime/descriptor.h"
 #include "flang/Runtime/entry-names.h"
 
 namespace Fortran::runtime {
-using SubscriptValue = ISO::CFI_index_t;
-using common::TypeCategory;
 
 extern "C" {
 
diff --git a/flang/include/flang/Runtime/io-api.h b/flang/include/flang/Runtime/io-api.h
index cee6b2cf033094..b86c3cecb32c5a 100644
--- a/flang/include/flang/Runtime/io-api.h
+++ b/flang/include/flang/Runtime/io-api.h
@@ -1,4 +1,4 @@
-//===-- include/flang-rt/io-api.h -------------------------------*- C++ -*-===//
+//===-- include/flang/Runtime/io-api.h --------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/flang/include/flang/Runtime/pointer.h b/flang/include/flang/Runtime/pointer.h
index c6d29db7218376..704144f08114f2 100644
--- a/flang/include/flang/Runtime/pointer.h
+++ b/flang/include/flang/Runtime/pointer.h
@@ -12,14 +12,10 @@
 #ifndef FORTRAN_RUNTIME_POINTER_H_
 #define FORTRAN_RUNTIME_POINTER_H_
 
-#include "flang/Common/Fortran-consts.h"
-#include "flang/Runtime/descriptor-consts.h"
+#include "flang/Runtime/descriptor.h"
 #include "flang/Runtime/entry-names.h"
 
 namespace Fortran::runtime {
-using SubscriptValue = ISO::CFI_index_t;
-using common::TypeCategory;
-
 extern "C" {
 
 // Data pointer initialization for NULLIFY(), "p=>NULL()`, & for ALLOCATE().
@@ -126,4 +122,4 @@ RT_API_ATTRS bool ValidatePointerPayload(const ISO::CFI_cdesc_t &);
 
 } // extern "C"
 } // namespace Fortran::runtime
-#endif /* FORTRAN_RUNTIME_POINTER_H_ */
+#endif // FORTRAN_RUNTIME_POINTER_H_
diff --git a/flang/include/flang/Semantics/semantics.h b/flang/include/flang/Semantics/semantics.h
index 65ec1ce1eb6e33..c03a0bad24a6e9 100644
--- a/flang/include/flang/Semantics/semantics.h
+++ b/flang/include/flang/Semantics/semantics.h
@@ -17,7 +17,6 @@
 #include "flang/Evaluate/intrinsics.h"
 #include "flang/Evaluate/target.h"
 #include "flang/Parser/message.h"
-#include "flang/Semantics/module-dependences.h"
 #include "flang/Support/Fortran-features.h"
 #include "flang/Support/LangOptions.h"
 #include <iosfwd>
diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index 8e5cf7f251501b..260966f82783a5 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -1419,4 +1419,4 @@ fir::getTypeSizeAndAlignmentOrCrash(mlir::Location loc, mlir::Type ty,
   if (result)
     return *result;
   TODO(loc, "computing size of a component");
-}
\ No newline at end of file
+}
diff --git a/flang/lib/Support/CMakeLists.txt b/flang/lib/Support/CMakeLists.txt
index a2badde61dfe64..8e0f0958952859 100644
--- a/flang/lib/Support/CMakeLists.txt
+++ b/flang/lib/Support/CMakeLists.txt
@@ -42,7 +42,6 @@ if(FLANG_VENDOR)
     PROPERTIES COMPILE_DEFINITIONS "FLANG_VENDOR=\"${FLANG_VENDOR} \"")
 endif()
 
-
 add_flang_library(FortranSupport
   Fortran.cpp
   Fortran-features.cpp
@@ -54,8 +53,8 @@ add_flang_library(FortranSupport
   ${version_inc}
 
   LINK_COMPONENTS
-    Support
+  Support
 
   LINK_LIBS
-    MLIRIR
+  MLIRIR
 )
diff --git a/flang/runtime/CUDA/allocatable.cpp b/flang/runtime/CUDA/allocatable.cpp
index e99cd40bbb07f8..9be54e8906903d 100644
--- a/flang/runtime/CUDA/allocatable.cpp
+++ b/flang/runtime/CUDA/allocatable.cpp
@@ -14,7 +14,6 @@
 #include "flang/Runtime/CUDA/descriptor.h"
 #include "flang/Runtime/CUDA/memmove-function.h"
 #include "flang/Runtime/allocatable.h"
-#include "flang/Runtime/descriptor.h"
 
 #include "cuda_runtime.h"
 
diff --git a/flang/unittests/Runtime/CUDA/Allocatable.cpp b/flang/unittests/Runtime/CUDA/Allocatable.cpp
index ddbcc3a1c9eefb..bdfa8f5cc3213c 100644
--- a/flang/unittests/Runtime/CUDA/Allocatable.cpp
+++ b/flang/unittests/Runtime/CUDA/Allocatable.cpp
@@ -13,8 +13,6 @@
 #include "flang/Runtime/CUDA/common.h"
 #include "flang/Runtime/CUDA/descriptor.h"
 #include "flang/Runtime/allocator-registry.h"
-#include "flang/Runtime/descriptor.h"
-#include "flang/Runtime/memory.h"
 #include "flang/Support/Fortran.h"
 
 #include "cuda_runtime.h"
diff --git a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp
index 68b74fab0c58dc..5ec122e4c5777f 100644
--- a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp
+++ b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp
@@ -12,8 +12,6 @@
 #include "flang/Runtime/CUDA/descriptor.h"
 #include "flang/Runtime/allocatable.h"
 #include "flang/Runtime/allocator-registry.h"
-#include "flang/Runtime/descriptor.h"
-#include "flang/Runtime/memory.h"
 #include "flang/Support/Fortran.h"
 
 #include "cuda_runtime.h"

>From 174336e81178c437e4be42d7a8abf3ab383ceb7f Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Sat, 11 Jan 2025 22:11:10 +0100
Subject: [PATCH 7/7] Avoid unrelated change

---
 flang/unittests/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index 3b8891e22151df..14e792de4895db 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -24,7 +24,7 @@ function(add_flang_unittest_offload_properties target)
   # FIXME: replace 'native' in --offload-arch option with the list
   #        of targets that Fortran Runtime was built for.
   #        Common code must be moved from flang/runtime/CMakeLists.txt.
-  if (FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD)
+  if (NOT FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD STREQUAL "off")
     set_target_properties(${target}
       PROPERTIES LINK_OPTIONS
       "-fopenmp;--offload-arch=native"



More information about the llvm-branch-commits mailing list