[libclc] [libclc] Skip opt command if opt_flags is empty (PR #130882)

Wenju He via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 21 18:13:28 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 "" )
----------------
wenju-he wrote:

let me know if it worth to update PR to unifies the code path and avoids early exit. Otherwise I'll close this PR.

The original request of this PR is to disable opt -O3. But things has changed and the request is irrelevant.
Though in practice it might still make sense to apply the PR to avoid code diverge like for SPIR-V.

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


More information about the cfe-commits mailing list