[libclc] [libclc] Remove bitcode prepare utility from OpenCL library build (PR #174447)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 5 09:27:02 PST 2026
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/174447
Summary:
This utility is unnecessary with the current usage. Right now it sets
linkage to linkonce_odr and deduplicates metadata nodes. The former is
not required as `-mlink-builtin-bitcode` will internalize all functions
anyway. The deduplication is no longer necessary as `llvm-link` handles
that. Removing this simplifies complexity and make it easier to
cross-build this utility as it no longer depends on host LLVM utilities
to be built in the proejct itself.
>From db5c41c232ea116bcaac5b8b9a82ac9cc2706123 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 5 Jan 2026 11:16:41 -0600
Subject: [PATCH] [libclc] Remove bitcode prepare utility from OpenCL library
build
Summary:
This utility is unnecessary with the current usage. Right now it sets
linkage to linkonce_odr and deduplicates metadata nodes. The former is
not required as `-mlink-builtin-bitcode` will internalize all functions
anyway. The deduplication is no longer necessary as `llvm-link` handles
that. Removing this simplifies complexity and make it easier to
cross-build this utility as it no longer depends on host LLVM utilities
to be built in the proejct itself.
---
libclc/CMakeLists.txt | 3 ---
libclc/cmake/modules/AddLibclc.cmake | 20 +++++++-------------
2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index f9ee80645b70f..5af5d946c7d63 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -198,9 +198,6 @@ list( SORT LIBCLC_TARGETS_TO_BUILD )
# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.
include_directories( ${LLVM_INCLUDE_DIRS} )
-# Configure prepare_builtins
-add_subdirectory( utils )
-
# Setup arch devices
set( r600--_devices cedar cypress barts cayman )
set( amdgcn--_devices tahiti )
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index 53b8fa91bf3fe..24792dca1e2d3 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -437,27 +437,21 @@ function(add_libclc_builtin_set)
# Non-SPIR-V targets add an extra step to optimize the bytecode
set( builtins_opt_lib_tgt builtins.opt.${ARG_ARCH_SUFFIX} )
- add_custom_command( OUTPUT ${LIBCLC_ARCH_OBJFILE_DIR}/${builtins_opt_lib_tgt}.bc
- COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${LIBCLC_ARCH_OBJFILE_DIR}/${builtins_opt_lib_tgt}.bc
+ set( obj_suffix ${ARG_ARCH_SUFFIX}.bc )
+ set( libclc_builtins_lib ${LIBCLC_OUTPUT_LIBRARY_DIR}/${obj_suffix} )
+
+ add_custom_command( OUTPUT ${libclc_builtins_lib}
+ COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${libclc_builtins_lib}
${builtins_link_lib}
DEPENDS ${opt_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
)
add_custom_target( ${builtins_opt_lib_tgt}
- ALL DEPENDS ${LIBCLC_ARCH_OBJFILE_DIR}/${builtins_opt_lib_tgt}.bc
+ ALL DEPENDS ${libclc_builtins_lib}
)
set_target_properties( ${builtins_opt_lib_tgt} PROPERTIES
- TARGET_FILE ${LIBCLC_ARCH_OBJFILE_DIR}/${builtins_opt_lib_tgt}.bc
+ TARGET_FILE ${libclc_builtins_lib}
FOLDER "libclc/Device IR/Opt"
)
-
- set( builtins_opt_lib $<TARGET_PROPERTY:${builtins_opt_lib_tgt},TARGET_FILE> )
-
- set( obj_suffix ${ARG_ARCH_SUFFIX}.bc )
- set( libclc_builtins_lib ${LIBCLC_OUTPUT_LIBRARY_DIR}/${obj_suffix} )
- add_custom_command( OUTPUT ${libclc_builtins_lib}
- COMMAND ${prepare_builtins_exe} -o ${libclc_builtins_lib} ${builtins_opt_lib}
- DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target}
- )
endif()
# Add a 'prepare' target
More information about the cfe-commits
mailing list