[LLVMbugs] [Bug 21039] New: bitfields result in really slow code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 23 02:45:41 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21039

            Bug ID: 21039
           Summary: bitfields result in really slow code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: jeroen.dobbelaere at synopsys.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13070
  --> http://llvm.org/bugs/attachment.cgi?id=13070&action=edit
test_bitfields.c: the testcase

Clang produces code that treats a bitfield as a part of a very large number,
consisting of all adjacent bitfields.
For structs containing a lot of bitfields, this can result in code loading,
storing and doing arithmetic operations on large numbers.

In the provided test example, we clear one specific bitfield.
On the x86/x86_64 architecture, this result in good code, but on all the other
architectures that I tried, the code results in unnecessary load/store
operations.

The problem seems to be that in the legalization and lowering phase, the
loading/masking/storing is split up in smaller chunks, but corresponding
load/stores are not optimized away. For x86, this is less of an issue as it
already knows how to map arithmetic operations onto memory.

Note: maybe the bigger problem is that clang maps bitfields onto such large
numbers in the first place ?

-- 
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/20140923/221914b1/attachment.html>


More information about the llvm-bugs mailing list