[llvm-commits] Enable early dup of any small bb

Rafael Ávila de Espíndola respindola at mozilla.com
Fri Jun 10 12:16:45 PDT 2011


My idea when I started working on PR10096 was to swap the 
responsibilities of early and late tail dup. The early one would 
duplicate small blocks and the late one would be the one responsible for 
duplicating the "large" blocks with indirectbr.

Unfortunately, we cannot really depend only on the late pass to handle 
indirectbr. In the firefox case, gcc produces code that looks like

	movq	(%rbx,%r12,8), %rax
         <code for this switch case>
	jmp	*%rax

clang changed to produce multiple indirectbr instructions produces
	<code for this switch case>
	jmpq    *(%rsi,%rdx,8)

and clang with only late tail dup (or when it gets lost in ra) produces

	leaq	(%rax,%rcx,8), %rax
	<code for this switch case>
	jmpq	*(%rax)

So it looks like we really have to fix the taildup,phielim,ra interaction.

The good news is that during benchmarking the options I found some bugs 
when early tail dup is enabled for bb without indirectbr in them. I 
fixed them an did some more benchmarking by just enabling it.

I got some interesting results. The build time stayed the same, XUL 64 
bits goes from 48745892 to 48735612 and firefox gets a bit faster 
1550.87runs/s to 1627.12runs/s in dromaeo in a current build.

I think the size reduction is because the blocks that we are duplicating 
early would be duplicated late anyway, we just have more passes to clean 
it up after us. Since this is just adding small blocks, the RA is still 
able to do a good job.

In summary, is the attached patch OK? :-)

Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dup.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110610/29994a60/attachment.ksh>


More information about the llvm-commits mailing list