[PATCH] memcpy lowering: use "rep movs" even when esi is used as base pointer

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Mar 11 13:09:13 PDT 2014


On 11 March 2014 13:10, Hans Wennborg <hans at chromium.org> wrote:
>
>   Ping?
>
>   Since I'm not very confident in the sdag and mi area, I was hoping someone could verify that:

It has been a long time since I worked on this, but I might be able to
help a bit.

>   1) I'm hooking up the sdag nodes correctly

The existing code is odd.

The "flag" has been called glue since r122310, so renaming the
variable might be a nice first cleanup :-). There seems to be more
glue than it is necessary, but that is probably not an issue.

I also see llc producing

movl 8(%ebp), %esi
leal 4(%esp), %edi
movl $22, %ecx
rep;movsl

Which seems to be the exact opposite of what the glue links would
imply. They are initially created in the correct order

        %ECX<def> = COPY %vreg4; GR32:%vreg4
        %EDI<def> = COPY %vreg3; GR32:%vreg3
        %ESI<def> = COPY %vreg1; GR32:%vreg1
        REP_MOVSD_32 %ECX<imp-def,dead>, %EDI<imp-def,dead>,
%ESI<imp-def,dead>, %ECX<imp-use>, %EDI<imp-use>, %ESI<imp-use>

The first time the order is different is in

# *** IR Dump After Virtual Register Rewriter ***:
...
32B             %ESI<def> = MOV32rm <fi#-1>, 1, %noreg, 0, %noreg;
mem:LD4[FixedStack-1](align=16)
48B             ADJCALLSTACKDOWN32 92, %ESP<imp-def>,
%EFLAGS<imp-def,dead>, %ESP<imp-use>
80B             %EDI<def> = LEA32r %ESP, 1, %noreg, 4, %noreg
112B            %ECX<def> = MOV32ri 22
160B            REP_MOVSD_32 %ECX<imp-def,dead>, %EDI<imp-def,dead>,
%ESI<imp-def,dead>, %ECX<imp-use,kill>, %EDI<imp-use>, %ESI<imp-use>

Andy, do you know what is going on? It is just that the Virtual
Register Rewriter knows when it is safe to ignore the glue links?

Cheers,
Rafael



More information about the llvm-commits mailing list