[libclc] 7d1adab - [libclc] Fix ctest failures after 7f3661128b1e: adjust external check and make shuffle helpers static (#160036)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 22 00:55:53 PDT 2025
Author: Wenju He
Date: 2025-09-22T15:55:49+08:00
New Revision: 7d1adab5a6f745f038bc774b8f2c381ae32845e0
URL: https://github.com/llvm/llvm-project/commit/7d1adab5a6f745f038bc774b8f2c381ae32845e0
DIFF: https://github.com/llvm/llvm-project/commit/7d1adab5a6f745f038bc774b8f2c381ae32845e0.diff
LOG: [libclc] Fix ctest failures after 7f3661128b1e: adjust external check and make shuffle helpers static (#160036)
* Replace call-site check with external declaration scan (grep declare)
to avoid false positives for not-inlined __clc_* functions.
* _clc_get_el* helpers are defined as inline in clc_shuffle2.cl, so they
have available_externally attribute. When they fail to inline they are
deleted by EliminateAvailableExternallyPass and become unresolved in
cedar-r600--.bc. Mark them static to resolve the issue.
---------
Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>
Added:
libclc/check_external_funcs.sh
Modified:
libclc/clc/lib/generic/misc/clc_shuffle.cl
libclc/clc/lib/generic/misc/clc_shuffle2.cl
libclc/cmake/modules/AddLibclc.cmake
Removed:
libclc/check_external_calls.sh
################################################################################
diff --git a/libclc/check_external_calls.sh b/libclc/check_external_funcs.sh
similarity index 63%
rename from libclc/check_external_calls.sh
rename to libclc/check_external_funcs.sh
index 25792e249d6b6..7de1488fc895c 100755
--- a/libclc/check_external_calls.sh
+++ b/libclc/check_external_funcs.sh
@@ -16,12 +16,12 @@ fi
TMP_FILE=$(mktemp)
-# Check for calls. Calls to llvm intrinsics are OK
-$DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE"
+# Check for external functions. Calls to llvm intrinsics are OK
+$DIS < $FILE | grep '^[[:space:]]*declare ' | grep -v '@llvm' > "$TMP_FILE"
COUNT=$(wc -l < "$TMP_FILE")
if [ "$COUNT" -ne "0" ]; then
- echo "ERROR: $COUNT unresolved calls detected in $FILE"
+ echo "ERROR: $COUNT unresolved external functions detected in $FILE"
cat $TMP_FILE
ret=1
else
diff --git a/libclc/clc/lib/generic/misc/clc_shuffle.cl b/libclc/clc/lib/generic/misc/clc_shuffle.cl
index f02e7aec9a0b8..bd7a6a18a6035 100644
--- a/libclc/clc/lib/generic/misc/clc_shuffle.cl
+++ b/libclc/clc/lib/generic/misc/clc_shuffle.cl
@@ -52,7 +52,7 @@
return VAR.sF;
#define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \
- _CLC_INLINE ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
+ static ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
ARGTYPE##ARGSIZE x, IDXTYPE idx) { \
switch (idx) { _CLC_ELEMENT_CASES##ARGSIZE(x) default : return 0; } \
}
diff --git a/libclc/clc/lib/generic/misc/clc_shuffle2.cl b/libclc/clc/lib/generic/misc/clc_shuffle2.cl
index db97f7c5cf960..786c2b6b6afd1 100644
--- a/libclc/clc/lib/generic/misc/clc_shuffle2.cl
+++ b/libclc/clc/lib/generic/misc/clc_shuffle2.cl
@@ -52,7 +52,7 @@
return VAR.sF;
#define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \
- _CLC_INLINE ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
+ static ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, IDXTYPE idx) { \
if (idx < ARGSIZE) \
switch (idx) { _CLC_ELEMENT_CASES##ARGSIZE(x) default : return 0; } \
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index aa8dd9859cd22..22dfaac9779a8 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -502,14 +502,14 @@ function(add_libclc_builtin_set)
return()
endif()
- # Add a test for whether or not the libraries contain unresolved calls which
- # would usually indicate a build problem. Note that we don't perform this
- # test for all libclc targets:
+ # Add a test for whether or not the libraries contain unresolved functions
+ # which would usually indicate a build problem. Note that we don't perform
+ # this test for all libclc targets:
# * nvptx-- targets don't include workitem builtins
# * clspv targets don't include all OpenCL builtins
if( NOT ARG_ARCH MATCHES "^(nvptx|clspv)(64)?$" )
- add_test( NAME external-calls-${obj_suffix}
- COMMAND ./check_external_calls.sh ${libclc_builtins_lib} ${LLVM_TOOLS_BINARY_DIR}
+ add_test( NAME external-funcs-${obj_suffix}
+ COMMAND ./check_external_funcs.sh ${libclc_builtins_lib} ${LLVM_TOOLS_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
endif()
More information about the cfe-commits
mailing list