This is an archive of the discontinued LLVM Phabricator instance.

Allow overriding bzero libcall from command line
AbandonedPublic

Authored by gchatelet on Oct 30 2019, 9:32 AM.

Details

Reviewers
courbet
Summary

bzero libcall is disabled except on Darwin version 10+.
This patch enables the use of bzero (especially on X86 when zeroing out memory) when user can provide a fast implementation.

Event Timeline

gchatelet created this revision.Oct 30 2019, 9:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2019, 9:32 AM
> cat test.cc
#include <cstring>

void foo(char* ptr, unsigned size) {
    memset(ptr, 0, size);
}
>  /tmp/llvm-project_dbg_compiled-with-clang/bin/clang++ test.cc --S -O3 -o-
# %bb.0:                                # %entry
        movl    %esi, %edx
        xorl    %esi, %esi
        jmp     memset                  # TAILCALL
>  /tmp/llvm-project_dbg_compiled-with-clang/bin/clang++ test.cc -mllvm --override-libcall-bzero=bzero -S -O3 -o-
# %bb.0:                                # %entry
        pushq   %rax
        movl    %esi, %esi
        callq   bzero
        popq    %rax
        retq
gchatelet abandoned this revision.Oct 31 2019, 6:59 AM

As discussed with @courbet I'm dropping this review because we don't want to add more backend flags.