[libclc] [libclc] Add an option to build SPIR-V targets with the LLVM backend (PR #151347)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 31 07:26:35 PDT 2025


================
@@ -363,10 +369,17 @@ function(add_libclc_builtin_set)
   if( ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64 )
     set( obj_suffix ${ARG_ARCH_SUFFIX}.spv )
     set( libclc_builtins_lib ${LIBCLC_OUTPUT_LIBRARY_DIR}/${obj_suffix} )
-    add_custom_command( OUTPUT ${libclc_builtins_lib}
-      COMMAND ${llvm-spirv_exe} ${spvflags} -o ${libclc_builtins_lib} ${builtins_link_lib}
-      DEPENDS ${llvm-spirv_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
-    )
+    if ( LIBCLC_USE_SPIRV_BACKEND )
+      add_custom_command( OUTPUT ${libclc_builtins_lib}
+        COMMAND ${clang_exe} --target=${ARG_TRIPLE} -x ir -o ${libclc_builtins_lib} ${builtins_link_lib}
----------------
frasercrmck wrote:

Good question! I'm not sure, to be honest. I tried using `-c` and it generates a slightly larger file (6900 vs 6792). It seems to take a few fewer seconds to do so, which is an upside. I haven't looked into what exactly it's doing.

https://github.com/llvm/llvm-project/pull/151347


More information about the cfe-commits mailing list