================ @@ -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:
> I just realised this code isn't triggered upstream. I take it you have a > downstream making use of it? there is a case in upstream LLVM that opt flag is empty: https://github.com/llvm/llvm-project/blob/ad5cac3b06c3cb41397acc1fc96beae9b460f20c/libclc/CMakeLists.txt#L353 > I tried it locally and this needs to be `if( "${ARG_OPT_FLAGS} STREQUAL "" )` > or maybe better yet `if ( NOT ARG_OPT_FLAGS )`. The code as-is generates an > error if I pass in an empty OPT_FLAGS: > > ``` > CMake Error at /llvm-project/libclc/cmake/modules/AddLibclc.cmake:345 (if): > if given arguments: > > "STREQUAL" "" > > Unknown arguments specified > ``` Thanks for the testing. Changed to `if ( NOT ARG_OPT_FLAGS )` I don't know what happened, a few days ago I did observe that bitcode size become smaller when opt flag is empty. https://github.com/llvm/llvm-project/pull/130882 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits