This patch addresses bug 15031.
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 28 Jan 2013 18:36:58 +0000 (18:36 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 28 Jan 2013 18:36:58 +0000 (18:36 +0000)
commit2e4ae4e1548aff9dace97240355c0cf73d2d3646
tree9989a36f660f90c70eaf0b0382b5cdb393907b72
parent0637c6926ddcbe6391d93dbd4b842faabcc72c23
This patch addresses bug 15031.

The common code in the post-RA scheduler to break anti-dependencies on the
critical path contained a flaw.  In the reported case, an anti-dependency
between the overlapping registers %X4 and %R4 exists:

%X29<def> = OR8 %X4, %X4
%R4<def>, %X3<def,dead,tied3> = LBZU 1, %X3<kill,tied1>

The unpatched code breaks the dependency by replacing %R4 and its uses
with %R3, the first register on the available list.  However, %R3 and
%X3 overlap, so this creates two overlapping definitions on the same
instruction.

The fix is straightforward, preventing selection of a register that
overlaps any other defined register on the same instruction.

The test case is reduced from the bug report, and verifies that we no
longer produce "lbzu 3, 1(3)" when breaking this anti-dependency.

llvm-svn: 173706
llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
llvm/lib/CodeGen/CriticalAntiDepBreaker.h
llvm/test/CodeGen/PowerPC/pr15031.ll [new file with mode: 0644]