[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 03:23:51 PDT 2025
================
@@ -342,22 +342,32 @@ function(add_libclc_builtin_set)
set( builtins_opt_lib_tgt builtins.opt.${ARG_ARCH_SUFFIX} )
- # Add opt target
- add_custom_command( OUTPUT ${builtins_opt_lib_tgt}.bc
- COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${builtins_opt_lib_tgt}.bc
- ${builtins_link_lib}
- DEPENDS ${opt_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
- )
- add_custom_target( ${builtins_opt_lib_tgt}
- ALL DEPENDS ${builtins_opt_lib_tgt}.bc
- )
+ if( ${ARG_OPT_FLAGS} STREQUAL "" )
----------------
frasercrmck wrote:
Yes, that might be good actually. Then if SPIR-V did ever want to apply optimizations, it could do so, and it ensures this path is tested.
Note though we'd still need the special-case after the opt target, because SPIR-V will continue to want to run `llvm-spirv` and exit. It also doesn't run the `${prepare_builtins_exe}` utility so needs to exit before that point. I don't know enough about `prepare-builtins` to say whether SPIR-V *could* also make use of it: it seems to strip `opencl.ocl.version` metadata and set every external definition to `linkonce_odr` linkage. I'd need to investigate what's going on there.
https://github.com/llvm/llvm-project/pull/130882
More information about the cfe-commits
mailing list