[LLVMdev] Emitting .zero

Chris Lattner clattner at apple.com
Thu Sep 16 17:51:40 PDT 2010


On Sep 16, 2010, at 5:12 PM, David Greene wrote:

> With LLVM 2.7, I see very inefficient emitting of zeros in .s files:
> 
> test_:                                  # @test_
> 	.quad	0                       # 0x0
> 	.quad	0                       # 0x0
> 	.quad	0                       # 0x0
> 	.quad	0                       # 0x0
> 	.quad	0                       # 0x0
> 	.quad	0                       # 0x0
>        [...]
> 	.quad	4                       # 0x4
> 	.quad	4                       # 0x4
> 	.quad	4                       # 0x4
> 	.quad	4                       # 0x4
>        [...]
> 
> The [...] pieces are huge.  This isn't a zeroinitializer so its not
> simply a matter of emitting zeroinitializers more efficiently.
> 
> Ideally we'd emit the zeros with a .zero directive.
> 
> In this case, doing so is the difference between a 3MB asm file and a
> 20MB asm file.
> 
> I searched the bug database but didn't find anything about this.  Has
> anyone looked at improving this?  If not I'll work on it and get a
> patch sent up.
> 
> But maybe it's fixed in 2.8 or something.

It's not fixed in 2.8, it sounds like it's simple code in AsmPrinter when emitting a ConstantStruct or something.  A simple testcase would be helpful.

-Chris



More information about the llvm-dev mailing list