[MachineSinking] Clear kill flag of all operands at all their uses.
authorJuergen Ributzka <juergen@apple.com>
Fri, 29 Aug 2014 23:48:03 +0000 (23:48 +0000)
committerJuergen Ributzka <juergen@apple.com>
Fri, 29 Aug 2014 23:48:03 +0000 (23:48 +0000)
commitbc420a0cc1f86b56d9987bbbc225f21669ae0f5d
treebeac6a587890448e0e9953687b2d0b6bea31c9dd
parent361153e264b07766dd1721e460247df14a802a6a
[MachineSinking] Clear kill flag of all operands at all their uses.

When sinking an instruction it might be moved past the original last use of one
of its operands. This last use has the kill flag set and the verifier will
obviously complain about this.

Before Machine Sinking (AArch64):
%vreg3<def> = ASRVXr %vreg1, %vreg2<kill>
%XZR<def> = SUBSXrs %vreg4, %vreg1<kill>, 160, %NZCV<imp-def>
...

After Machine Sinking:
%XZR<def> = SUBSXrs %vreg4, %vreg1<kill>, 160, %NZCV<imp-def>
...
%vreg3<def> = ASRVXr %vreg1, %vreg2<kill>

This fix clears all the kill flags in all instruction that use the same operands
as the instruction that is being sunk.

This fixes rdar://problem/18180996.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216803 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineSink.cpp
test/CodeGen/AArch64/fast-isel-machine-sink.ll [new file with mode: 0644]