[PATCH] Teach rematerialiser more about subregs

Tim Northover tnorthover at apple.com
Wed May 29 08:23:07 PDT 2013


Hi,

The attached patch should allow the rematerializer (during register coalescing) to handle sub-register indices more intelligently. Previously CodeGen could produce something like:

%vreg1:sub_32 = MOVZwii whatever
%vreg2 = COPY %vreg1

(where both registers have class GPR64). This ought to be a candidate for rematerialisation, producing

%vreg2:sub_32 = MOVZwii whatever

however, the code at the moment doesn't attempt anything since %vreg2 itself isn't an appropriate operand for MOVZwii (which takes a GPR32).

The main motivation for this is the also-attached patch motive-mov0.diff (purely for illustration, not review at the moment). It replaces X86's nasty MOVXXr0 instructions with a single MOV32r0 variant to reduce sub-register hackery in MCInstLowering. 

Without this remat patch in place, extra failures occur in specific X86 remat tests. With the patch, some modifications are needed but essentially all dematerialisations we expect can occur in one form or another.

This is an area that's rather new to me so I'd appreciate someone checking I've not gone horribly wrong. Should I commit?

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rematerialisation.diff
Type: application/octet-stream
Size: 8701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130529/ba11daae/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: motive-mov0.diff
Type: application/octet-stream
Size: 20328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130529/ba11daae/attachment-0001.obj>


More information about the llvm-commits mailing list