R600: Fix scheduling of instructions that use the LDS output queue
authorTom Stellard <thomas.stellard@amd.com>
Fri, 15 Nov 2013 00:12:45 +0000 (00:12 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 15 Nov 2013 00:12:45 +0000 (00:12 +0000)
commit19a99df130f5747da950faf4ca5170d71f05594c
tree9fa3fe9f4458c88dafaef52b94685ac7b0fbea8e
parent1ccba3161c5285a74921f0ff183e18a3e0343710
R600: Fix scheduling of instructions that use the LDS output queue

The LDS output queue is accessed via the OQAP register.  The OQAP
register cannot be live across clauses, so if value is written to the
output queue, it must be retrieved before the end of the clause.
With the machine scheduler, we cannot statisfy this constraint, because
it lacks proper alias analysis and it will mark some LDS accesses as
having a chain dependency on vertex fetches.  Since vertex fetches
require a new clauses, the dependency may end up spiltting OQAP uses and
defs so the end up in different clauses.  See the lds-output-queue.ll
test for a more detailed explanation.

To work around this issue, we now combine the LDS read and the OQAP
copy into one instruction and expand it after register allocation.

This patch also adds some checks to the EmitClauseMarker pass, so that
it doesn't end a clause with a value still in the output queue and
removes AR.X and OQAP handling from the scheduler (AR.X uses and defs
were already being expanded post-RA, so the scheduler will never see
them).

Reviewed-by: Vincent Lejeune <vljn at ovi.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194755 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/R600/R600EmitClauseMarkers.cpp
lib/Target/R600/R600ExpandSpecialInstrs.cpp
lib/Target/R600/R600ISelLowering.cpp
lib/Target/R600/R600InstrInfo.cpp
lib/Target/R600/R600InstrInfo.h
lib/Target/R600/R600MachineScheduler.cpp
lib/Target/R600/R600MachineScheduler.h
lib/Target/R600/R600RegisterInfo.cpp
lib/Target/R600/R600RegisterInfo.h
test/CodeGen/R600/lds-output-queue.ll [new file with mode: 0644]
test/CodeGen/R600/local-memory-two-objects.ll