Skip to content

Commit 7d1adab

Browse files
wenju-heCopilot
andauthored
[libclc] Fix ctest failures after 7f36611: adjust external check and make shuffle helpers static (llvm#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 <[email protected]>
1 parent 7d1952a commit 7d1adab

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

libclc/check_external_calls.sh renamed to libclc/check_external_funcs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ fi
1616

1717
TMP_FILE=$(mktemp)
1818

19-
# Check for calls. Calls to llvm intrinsics are OK
20-
$DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE"
19+
# Check for external functions. Calls to llvm intrinsics are OK
20+
$DIS < $FILE | grep '^[[:space:]]*declare ' | grep -v '@llvm' > "$TMP_FILE"
2121
COUNT=$(wc -l < "$TMP_FILE")
2222

2323
if [ "$COUNT" -ne "0" ]; then
24-
echo "ERROR: $COUNT unresolved calls detected in $FILE"
24+
echo "ERROR: $COUNT unresolved external functions detected in $FILE"
2525
cat $TMP_FILE
2626
ret=1
2727
else

libclc/clc/lib/generic/misc/clc_shuffle.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
return VAR.sF;
5353

5454
#define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \
55-
_CLC_INLINE ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
55+
static ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
5656
ARGTYPE##ARGSIZE x, IDXTYPE idx) { \
5757
switch (idx) { _CLC_ELEMENT_CASES##ARGSIZE(x) default : return 0; } \
5858
}

libclc/clc/lib/generic/misc/clc_shuffle2.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
return VAR.sF;
5353

5454
#define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \
55-
_CLC_INLINE ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
55+
static ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE( \
5656
ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, IDXTYPE idx) { \
5757
if (idx < ARGSIZE) \
5858
switch (idx) { _CLC_ELEMENT_CASES##ARGSIZE(x) default : return 0; } \

libclc/cmake/modules/AddLibclc.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,14 @@ function(add_libclc_builtin_set)
502502
return()
503503
endif()
504504

505-
# Add a test for whether or not the libraries contain unresolved calls which
506-
# would usually indicate a build problem. Note that we don't perform this
507-
# test for all libclc targets:
505+
# Add a test for whether or not the libraries contain unresolved functions
506+
# which would usually indicate a build problem. Note that we don't perform
507+
# this test for all libclc targets:
508508
# * nvptx-- targets don't include workitem builtins
509509
# * clspv targets don't include all OpenCL builtins
510510
if( NOT ARG_ARCH MATCHES "^(nvptx|clspv)(64)?$" )
511-
add_test( NAME external-calls-${obj_suffix}
512-
COMMAND ./check_external_calls.sh ${libclc_builtins_lib} ${LLVM_TOOLS_BINARY_DIR}
511+
add_test( NAME external-funcs-${obj_suffix}
512+
COMMAND ./check_external_funcs.sh ${libclc_builtins_lib} ${LLVM_TOOLS_BINARY_DIR}
513513
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
514514
endif()
515515

0 commit comments

Comments
 (0)