[MachineSinking] Conservatively clear kill flags after coalescing.
authorPatrik Hagglund <patrik.h.hagglund@ericsson.com>
Tue, 9 Sep 2014 07:47:00 +0000 (07:47 +0000)
committerPatrik Hagglund <patrik.h.hagglund@ericsson.com>
Tue, 9 Sep 2014 07:47:00 +0000 (07:47 +0000)
commit3008bee7d9dfe955436ef04b20b5b34cb2397c3e
treea359b8318933e74be989dc7262f52e7a7b477e0c
parent39d5e80b446529e76afdc5da6d0428a8a6720f06
[MachineSinking] Conservatively clear kill flags after coalescing.

This solves the problem of having a kill flag inside a loop
with a definition of the register prior to the loop:

%vreg368<def> ...

Inside loop:

        %vreg520<def> = COPY %vreg368
        %vreg568<def,tied1> = add %vreg341<tied0>, %vreg520<kill>

=> was coalesced into =>

        %vreg568<def,tied1> = add %vreg341<tied0>, %vreg368<kill>

MachineVerifier then complained:
*** Bad machine code: Virtual register killed in block, but needed live out. ***

The kill flag for %vreg368 is incorrect, and is cleared by this patch.

This is similar to the clearing done at the end of
MachineSinking::SinkInstruction().

Patch provided by Jonas Paulsson.

Reviewed by Quentin Colombet and Juergen Ributzka.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217427 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineSink.cpp