[llvm-commits] [llvm] r45605 - in /llvm/trunk/lib/Target/X86: X86ATTAsmPrinter.cpp X86CodeEmitter.cpp X86ISelDAGToDAG.cpp X86InstrInfo.td X86MachineFunctionInfo.h

Evan Cheng evan.cheng at apple.com
Sat Jan 5 00:54:45 PST 2008


Cool!

Evan

On Jan 4, 2008, at 5:04 PM, Chris Lattner wrote:

> On Jan 4, 2008, at 4:41 PM, Evan Cheng wrote:
>> Author: evancheng
>> Date: Fri Jan  4 18:41:47 2008
>> New Revision: 45605
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=45605&view=rev
>> Log:
>> Combine MovePCtoStack + POP32r into one instruction MOVPC32r so it
>> can be moved if needed.
>
> Nice evan!  With this, sinking is now able to compile code like this:
>
> int G;
> int test(int X, int Y) {
>    if (X)
>      return G+Y;
>    return 0;
> }
>
> into:
>
> _test:
> 	cmpl	$0, 4(%esp)
> 	je	LBB2_2	# UnifiedReturnBlock
> LBB2_1:	# cond_true
> 	call	"L2$pb"
> "L2$pb":
> 	popl	%ecx
> 	movl	8(%esp), %eax
> 	movl	L_G$non_lazy_ptr-"L2$pb"(%ecx), %ecx
> 	addl	(%ecx), %eax
> 	ret
> LBB2_2:	# UnifiedReturnBlock
> 	xorl	%eax, %eax
> 	ret
>
> instead of:
>
> _test:
> 	call	"L2$pb"
> "L2$pb":
> 	popl	%ecx
> 	cmpl	$0, 4(%esp)
> 	movl	8(%esp), %eax
> 	je	LBB2_2	# UnifiedReturnBlock
> LBB2_1:	# cond_true
> 	movl	L_G$non_lazy_ptr-"L2$pb"(%ecx), %ecx
> 	addl	(%ecx), %eax
> 	ret
> LBB2_2:	# UnifiedReturnBlock
> 	xorl	%eax, %eax
> 	ret
>
>
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list