[llvm-bugs] [Bug 17955] LLVM 3.3 misses bitfield optimization

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 16 00:23:57 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=17955

Eric Christopher <echristo at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Eric Christopher <echristo at gmail.com> ---
We produce similar code (though not the same) to gcc here now:

dzur:~/tmp> cat > foo.c
struct foo {
  int f_x : 1;
  int f_y : 1;
};

int fun(struct foo *f) {
  return f->f_x || f->f_y;
}
dzur:~/tmp> ~/builds/build-llvm/Debug+Asserts/bin/clang -O2 -S -o - foo.c
    .text
    .file    "foo.c"
    .globl    fun
    .align    16, 0x90
    .type    fun, at function
fun:                                    # @fun
    .cfi_startproc
# BB#0:                                 # %entry
    testb    $3, (%rdi)
    setne    %al
    movzbl    %al, %eax
    retq
.Lfunc_end0:
    .size    fun, .Lfunc_end0-fun
    .cfi_endproc


    .ident    "clang version 3.8.0 (trunk 250477) (llvm/trunk 250464)"
    .section    ".note.GNU-stack","", at progbits
dzur:~/tmp> gcc -O2 -S -o - foo.c
    .file    "foo.c"
    .text
    .p2align 4,,15
    .globl    fun
    .type    fun, @function
fun:
.LFB0:
    .cfi_startproc
    xorl    %eax, %eax
    testb    $3, (%rdi)
    setne    %al
    ret
    .cfi_endproc
.LFE0:
    .size    fun, .-fun
    .ident    "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"
    .section    .note.GNU-stack,"", at progbits

Happy David?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151016/270fa03f/attachment.html>


More information about the llvm-bugs mailing list