[llvm-branch-commits] [llvm] c45fa58 - [libomptarget][amdcgn] Only add opt/llvm-link dependency if TARGET is available
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 3 15:49:58 PDT 2021
Author: Joachim Protze
Date: 2021-09-03T15:49:42-07:00
New Revision: c45fa58f171e72176c3df71909f2b85137cd909f
URL: https://github.com/llvm/llvm-project/commit/c45fa58f171e72176c3df71909f2b85137cd909f
DIFF: https://github.com/llvm/llvm-project/commit/c45fa58f171e72176c3df71909f2b85137cd909f.diff
LOG: [libomptarget][amdcgn] Only add opt/llvm-link dependency if TARGET is available
In some build configurations, the target we depend on is not available for declaring the build dependency.
We only need to declare the build dependency, if the build target is available in the same build.
Fixes the issue raised in https://reviews.llvm.org/D107156#2969862
This patch should go into release/13 together with D108404
Differential Revision: https://reviews.llvm.org/D108868
(cherry picked from commit 5ea1c37118699f0ed1da17e0d8562011d0002edd)
Added:
Modified:
llvm/runtimes/CMakeLists.txt
openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index b972933b1f795..3436cd8bdfbef 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -350,9 +350,14 @@ if(runtimes)
# Create a runtimes target that uses this file as its top-level CMake file.
# The runtimes target is a configuration of all the runtime libraries
# together in a single CMake invocaiton.
+ set(extra_deps "")
if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
- message(STATUS "Adding dependencies opt llvm-link")
- set(extra_deps opt llvm-link)
+ if(TARGET opt)
+ list(APPEND extra_deps opt)
+ endif()
+ if(TARGET llvm-link)
+ list(APPEND extra_deps llvm-link)
+ endif()
endif()
if(NOT LLVM_RUNTIME_TARGETS)
runtime_default_target(
diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
index 6753b9708cdc4..e398f398c7760 100644
--- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
@@ -149,6 +149,14 @@ endmacro()
set(libname "omptarget-amdgcn")
+set(toolchain_deps "")
+if(TARGET llvm-link)
+ list(APPEND toolchain_deps llvm-link)
+endif()
+if(TARGET opt)
+ list(APPEND toolchain_deps opt)
+endif()
+
foreach(mcpu ${mcpus})
set(bc_files)
add_cuda_bc_library(${cuda_sources})
@@ -157,7 +165,7 @@ foreach(mcpu ${mcpus})
add_custom_command(
OUTPUT ${bc_libname}
COMMAND ${LINK_TOOL} ${bc_files} | ${OPT_TOOL} --always-inline -o ${OUTPUTDIR}/${bc_libname}
- DEPENDS ${bc_files} llvm-link opt)
+ DEPENDS ${bc_files} ${toolchain_deps})
add_custom_target(lib${libname}-${mcpu} ALL DEPENDS ${bc_libname})
More information about the llvm-branch-commits
mailing list