summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-01-06 19:52:04 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-01-06 19:52:04 +0000
commitb3931b814adc8a6c3d6b8b1d6a2a0faa6d4cdc52 (patch)
tree94e9c1ecb57e7a4b42a61d1cfb83cd257f63ecb2 /llvm/lib
parent52f943b5362f81db68670c018c4a0bb236d0161a (diff)
downloadbcm5719-llvm-b3931b814adc8a6c3d6b8b1d6a2a0faa6d4cdc52.tar.gz
bcm5719-llvm-b3931b814adc8a6c3d6b8b1d6a2a0faa6d4cdc52.zip
R600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits
In DS write instructions, the address operand comes before the value operand(s) which is reversed from every other instruction type. The SIInsertWait assumed that the first use for each instruction was the value, so for DS write it was protecting the address operand with s_waitcnt instructions when it should have been protecting the value operand. llvm-svn: 225289
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/R600/SIInsertWaits.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/SIInsertWaits.cpp b/llvm/lib/Target/R600/SIInsertWaits.cpp
index f279e5e5c58..2e56508e2fa 100644
--- a/llvm/lib/Target/R600/SIInsertWaits.cpp
+++ b/llvm/lib/Target/R600/SIInsertWaits.cpp
@@ -186,6 +186,29 @@ bool SIInsertWaits::isOpRelevant(MachineOperand &Op) {
if (!MI.getDesc().mayStore())
return false;
+ // Check if this operand is the value being stored.
+ // Special case for DS instructions, since the address
+ // operand comes before the value operand and it may have
+ // multiple data operands.
+
+ if (TII->isDS(MI.getOpcode())) {
+ MachineOperand *Data = TII->getNamedOperand(MI, AMDGPU::OpName::data);
+ if (Data && Op.isIdenticalTo(*Data))
+ return true;
+
+ MachineOperand *Data0 = TII->getNamedOperand(MI, AMDGPU::OpName::data0);
+ if (Data0 && Op.isIdenticalTo(*Data0))
+ return true;
+
+ MachineOperand *Data1 = TII->getNamedOperand(MI, AMDGPU::OpName::data1);
+ if (Data1 && Op.isIdenticalTo(*Data1))
+ return true;
+
+ return false;
+ }
+
+ // NOTE: This assumes that the value operand is before the
+ // address operand, and that there is only one value operand.
for (MachineInstr::mop_iterator I = MI.operands_begin(),
E = MI.operands_end(); I != E; ++I) {
OpenPOWER on IntegriCloud