llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-libc Author: None (llvmbot) <details> <summary>Changes</summary> Backport 8e43acbfedf53ded43ec693ddaaf518cb7416c1c Requested by: @<!-- -->jhuber6 --- Full diff: https://github.com/llvm/llvm-project/pull/100496.diff 2 Files Affected: - (modified) libc/cmake/modules/LLVMLibCCompileOptionRules.cmake (+1-10) - (modified) libc/cmake/modules/LLVMLibCObjectRules.cmake (+11) ``````````diff diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake index 97d1c7262d24d..7a1c45a814eb6 100644 --- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake +++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake @@ -104,16 +104,7 @@ function(_get_common_compile_options output_var flags) list(APPEND compile_options "-ffixed-point") endif() - # Builtin recognition causes issues when trying to implement the builtin - # functions themselves. The GPU backends do not use libcalls so we disable - # the known problematic ones. This allows inlining during LTO linking. - if(LIBC_TARGET_OS_IS_GPU) - set(libc_builtins bcmp strlen memmem bzero memcmp memcpy memmem memmove - memset strcmp strstr) - foreach(builtin ${libc_builtins}) - list(APPEND compile_options "-fno-builtin-${builtin}") - endforeach() - else() + if(NOT LIBC_TARGET_OS_IS_GPU) list(APPEND compile_options "-fno-builtin") endif() diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake index 2d3db38ecd8a3..68b5ed1ed51c0 100644 --- a/libc/cmake/modules/LLVMLibCObjectRules.cmake +++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake @@ -279,6 +279,17 @@ function(create_entrypoint_object fq_target_name) add_dependencies(${fq_target_name} ${full_deps_list}) target_link_libraries(${fq_target_name} ${full_deps_list}) + # Builtin recognition causes issues when trying to implement the builtin + # functions themselves. The GPU backends do not use libcalls so we disable the + # known problematic ones on the entrypoints that implement them. + if(LIBC_TARGET_OS_IS_GPU) + set(libc_builtins bcmp strlen memmem bzero memcmp memcpy memmem memmove + memset strcmp strstr) + if(${ADD_ENTRYPOINT_OBJ_NAME} IN_LIST libc_builtins) + target_compile_options(${fq_target_name} PRIVATE -fno-builtin-${ADD_ENTRYPOINT_OBJ_NAME}) + endif() + endif() + set_target_properties( ${fq_target_name} PROPERTIES `````````` </details> https://github.com/llvm/llvm-project/pull/100496 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits