[PATCH] Add another run of ARM Thumb2SizeReduction pass with -Oz

Pete Cooper peter_cooper at apple.com
Wed Mar 11 16:00:53 PDT 2015


Hi Quentin

Please review this patch to more aggressively reduce the size of thumb2 functions when methods have -Oz on them.  This is similar to the work you did in r170462, hence asking you to be the reviewer for this one.

The issue I found is that the PostRA scheduler can schedule a mov instruction between a cmp and ‘it’ block, e.g.,

	cmp	r0, #0                  @ encoding: [0x00,0x28]
	mov.w	r3, #0                  @ encoding: [0x4f,0xf0,0x00,0x03]
	it	eq                      @ encoding: [0x08,0xbf]

This results in the mov instruction here being a 4-byte encoding whereas it could be a 2-byte encoding if CPSR wasn’t live.

This patch schedules another pass of Thumb2SizeReduction before the PostRA scheduler.  This pass is only for functions with minsize set on them.  It results in the mov being converted to Thumb2 before the PostRA scheduler and so the code now becomes


	movs	r3, #0                  @ encoding: [0x00,0x23]
	cmp	r0, #0                  @ encoding: [0x00,0x28]
	it	eq                      @ encoding: [0x08,0xbf]

Thanks,
Pete

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150311/31845427/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reduce.diff
Type: application/octet-stream
Size: 4584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150311/31845427/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150311/31845427/attachment-0001.html>


More information about the llvm-commits mailing list