https://github.com/wenju-he created 
https://github.com/llvm/llvm-project/pull/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.

>From 47eb95442b6a72f06e3d611ebf7d8fa0006c2063 Mon Sep 17 00:00:00 2001
From: Wenju He <[email protected]>
Date: Mon, 22 Sep 2025 07:22:18 +0200
Subject: [PATCH] [libclc] Fix ctest failures after 7f3661128b1e: adjust
 external check and make shuffle helpers static

* 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.
---
 ...check_external_calls.sh => check_external_funcs.sh} |  6 +++---
 libclc/clc/lib/generic/misc/clc_shuffle.cl             |  2 +-
 libclc/clc/lib/generic/misc/clc_shuffle2.cl            |  2 +-
 libclc/cmake/modules/AddLibclc.cmake                   | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)
 rename libclc/{check_external_calls.sh => check_external_funcs.sh} (64%)

diff --git a/libclc/check_external_calls.sh b/libclc/check_external_funcs.sh
similarity index 64%
rename from libclc/check_external_calls.sh
rename to libclc/check_external_funcs.sh
index 25792e249d6b6..fea7e157cf226 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 '^\s*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()
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to