https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67513

--- Comment #4 from Andrey Ryabinin <ryabinin.a.a at gmail dot com> ---
(In reply to Andrey Ryabinin from comment #3)
> (In reply to Yury Gribov from comment #1)
> > (In reply to Andrey Ryabinin from comment #0)
> > > (shadow value is usually zero).
> > 
> > What makes you think so? AFAIU for less-than-8-byte scalars it's always
> > non-zero.
> 
> If 'a' is a pointer to an individual stack/global variable then yes, shadow
> will be non-zero.
> But if it's part of some array or a struct field, more likely shadow will be
> zero.
> So I'm not saying that we should blindly switch to non-zero test first, but
> it definitely worth trying.
> 
> > I vaguely remember than Kostya did something like this in Clang
> > case and it resulted in negligeable improvement.
> 
> clang (version 3.7.0 (tags/RELEASE_370/final))
> tests for non-zero first:
> 
this was a dump from slightly different test-case, here is correct one:

foo:                                    # @foo
        .cfi_startproc
# BB#0:
        pushq   %rax
.Ltmp0:
        .cfi_def_cfa_offset 16
        movq    %rdi, %rax
        shrq    $3, %rax
        movb    2147450880(%rax), %al
        testb   %al, %al
        jne     .LBB0_1
.LBB0_3:
        movb    $0, (%rdi)
        popq    %rax
        retq
.LBB0_1:
        movl    %edi, %ecx
        andl    $7, %ecx
        movsbl  %al, %eax
        cmpl    %eax, %ecx
        jl      .LBB0_3
# BB#2:
        callq   __asan_report_store1
        #APP
        #NO_APP
.Lfunc_end0:
        .size   foo, .Lfunc_end0-foo
        .cfi_endproc

Reply via email to