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

Justin Holewinski justin.holewinski at gmail.com
Fri Mar 15 07:54:30 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130315/8fb640ce/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Propagate-DAG-node-ordering-during-type-legalization.patch
Type: application/octet-stream
Size: 9788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130315/8fb640ce/attachment.obj>


More information about the llvm-commits mailing list