[LLVMbugs] [Bug 1324] NEW: Reduce memory for "strings" and other simple global initializers

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Apr 13 16:17:09 PDT 2007


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

           Summary: Reduce memory for "strings" and other simple global
                    initializers
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


Some programs use a large number of strings and other dense data objects.  We currently represent 
these as a ConstantArray of ConstantInt objects.  If you have a string that is 100 characters long, you're 
talking about ~2-3K to represent this thing, depending on how many common characters in the string 
there are.  The absolute minimum 100 characters can take is > 1600 bytes, because that is the cost of 
the OperandList for the ConstantArray (doh).

Way back in the early days, we had the same problem with zero initialized memory.  To fix that, we 
introduced zeroinitializer (aka ConstantAggregateZero).  I think we should introduce a new 
ConstantAggregateData object which can be used for arrays/structs/vectors that have intializers that 
don't require relocations (intializers with relocations can always use the existing ConstantArray etc).  
This is an extremely common case, and will cut down memory use for things like kc++ dramatically.

In the case of our 100 byte string above, we'd replace a 1600 byte operand list with a 100 byte blob of 
memory.

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list