summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU
diff options
context:
space:
mode:
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2020-01-13 17:01:36 -0800
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2020-01-14 01:18:59 -0800
commitad741853c38880dff99cd5b5035b8965c5a73011 (patch)
tree74aff53a8758bb76d669d08349b90e5cd0ed4526 /llvm/lib/Target/AMDGPU
parent6d8abe424a77f736fbed114eeac574b9bfe6b0c1 (diff)
downloadbcm5719-llvm-ad741853c38880dff99cd5b5035b8965c5a73011.tar.gz
bcm5719-llvm-ad741853c38880dff99cd5b5035b8965c5a73011.zip
[AMDGPU] Model distance to instruction in bundle
This change allows to model the height of the instruction within a bundle for latency adjustment purposes. Differential Revision: https://reviews.llvm.org/D72669
Diffstat (limited to 'llvm/lib/Target/AMDGPU')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
index af1dc8d7a48..445e9109249 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -730,14 +730,26 @@ void GCNSubtarget::adjustSchedDependency(SUnit *Src, SUnit *Dst,
auto Reg = Dep.getReg();
MachineBasicBlock::const_instr_iterator I(SrcI->getIterator());
MachineBasicBlock::const_instr_iterator E(SrcI->getParent()->instr_end());
+ unsigned Lat = 0;
for (++I; I != E && I->isBundledWithPred(); ++I) {
- if (!I->modifiesRegister(Reg, TRI))
- continue;
- Dep.setLatency(InstrInfo.getInstrLatency(getInstrItineraryData(), *I));
- break;
+ if (I->modifiesRegister(Reg, TRI))
+ Lat = InstrInfo.getInstrLatency(getInstrItineraryData(), *I);
+ else if (Lat)
+ --Lat;
}
+ Dep.setLatency(Lat);
} else if (DstI->isBundle()) {
- Dep.setLatency(InstrInfo.getInstrLatency(getInstrItineraryData(), *SrcI));
+ const SIRegisterInfo *TRI = getRegisterInfo();
+ auto Reg = Dep.getReg();
+ MachineBasicBlock::const_instr_iterator I(DstI->getIterator());
+ MachineBasicBlock::const_instr_iterator E(DstI->getParent()->instr_end());
+ unsigned Lat = InstrInfo.getInstrLatency(getInstrItineraryData(), *SrcI);
+ for (++I; I != E && I->isBundledWithPred() && Lat; ++I) {
+ if (I->readsRegister(Reg, TRI))
+ break;
+ --Lat;
+ }
+ Dep.setLatency(Lat);
}
}
OpenPOWER on IntegriCloud