[PATCH] Propagate DAG node ordering during legalization and instruction selection

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Mar 15 09:31:21 PDT 2013


Hi Justin,

The x87 stack is always a bit strange. It's probably easier to compare the outputs of -print-machineinstrs.

/jakob

On Mar 15, 2013, at 7:54 AM, Justin Holewinski <justin.holewinski at gmail.com> wrote:

> The attached patch modifies DAGTypeLegalizer and SelectionDAGISel to propagate DAG node ordering.  We currently (for better or for worse) use source scheduling, and we're being hit by issues in the scheduler due to the ordering being lost.
> 
> 
> One issue with this patch is that is causes one X86 test to fail: win_ftol2
> 
> The only meaningful difference I can spot (other than an extra spill) is that the 'fxch' instruction is eliminated.  Can anyone more familiar with the X86 back-end comment on why DAG node ordering would affect this test?  I've narrowed the issue down to being caused by this patch's change to DAGTypeLegalizer::SetExpandedInteger. (e.g. if this method propagates DAG node ordering in the newly created nodes, this test starts to fail).
> 
> 
> Current Output:
> 
> _double_ui64_2:                         # @double_ui64_2
> # BB#0:
> 	pushl	%ebp
> 	movl	%esp, %ebp
> 	pushl	%esi
> 	andl	$-8, %esp
> 	subl	$32, %esp
> 	fldl	24(%ebp)
> 	fldl	16(%ebp)
> 	fldl	8(%ebp)
> 	fdiv	%st(0), %st(1)
> 	fsubp	%st(2)
> 	fxch
> 	calll	__ftol2
> 	movl	%eax, 4(%esp)           # 4-byte Spill
> 	movl	%edx, (%esp)            # 4-byte Spill
> 	calll	__ftol2
> 	movl	4(%esp), %ecx           # 4-byte Reload
> 	subl	%ecx, %eax
> 	movl	(%esp), %esi            # 4-byte Reload
> 	sbbl	%esi, %edx
> 	leal	-4(%ebp), %esp
> 	popl	%esi
> 	popl	%ebp
> 	ret
> 
> 
> Output With Patch:
> 
> _double_ui64_2:                         # @double_ui64_2
> # BB#0:
> 	pushl	%ebp
> 	movl	%esp, %ebp
> 	andl	$-8, %esp
> 	subl	$32, %esp
> 	fldl	24(%ebp)
> 	fldl	16(%ebp)
> 	fldl	8(%ebp)
> 	fdiv	%st(0), %st(1)
> 	fsubp	%st(2)
> 	calll	__ftol2
> 	movl	%eax, 12(%esp)          # 4-byte Spill
> 	movl	%edx, 8(%esp)           # 4-byte Spill
> 	calll	__ftol2
> 	movl	12(%esp), %ecx          # 4-byte Reload
> 	subl	%eax, %ecx
> 	movl	8(%esp), %eax           # 4-byte Reload
> 	sbbl	%edx, %eax
> 	movl	%eax, 4(%esp)           # 4-byte Spill
> 	movl	%ecx, %eax
> 	movl	4(%esp), %edx           # 4-byte Reload
> 	movl	%ebp, %esp
> 	popl	%ebp
> 	ret
> 
> 
> -- 
> 
> Thanks,
> 
> Justin Holewinski
> <0001-Propagate-DAG-node-ordering-during-type-legalization.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130315/bab36edb/attachment.html>


More information about the llvm-commits mailing list