[llvm] r176342 - R600/SI: fix inserting waits for unordered defines
Christian Konig
christian.koenig at amd.com
Fri Mar 1 01:46:04 PST 2013
Author: ckoenig
Date: Fri Mar 1 03:46:04 2013
New Revision: 176342
URL: http://llvm.org/viewvc/llvm-project?rev=176342&view=rev
Log:
R600/SI: fix inserting waits for unordered defines
Signed-off-by: Christian König <christian.koenig at amd.com>
Modified:
llvm/trunk/lib/Target/R600/SIInsertWaits.cpp
Modified: llvm/trunk/lib/Target/R600/SIInsertWaits.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInsertWaits.cpp?rev=176342&r1=176341&r2=176342&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIInsertWaits.cpp (original)
+++ llvm/trunk/lib/Target/R600/SIInsertWaits.cpp Fri Mar 1 03:46:04 2013
@@ -88,6 +88,9 @@ private:
MachineBasicBlock::iterator I,
const Counters &Counts);
+ /// \brief Do we need def2def checks?
+ bool unorderedDefines(MachineInstr &MI);
+
/// \brief Resolve all operand dependencies to counter requirements
Counters handleOperands(MachineInstr &MI);
@@ -125,7 +128,7 @@ Counters SIInsertWaits::getHwCounts(Mach
// Only consider stores or EXP for EXP_CNT
Result.Named.EXP = !!(TSFlags & SIInstrFlags::EXP_CNT &&
- (MI.getOpcode() == AMDGPU::EXP || !MI.getDesc().mayStore()));
+ (MI.getOpcode() == AMDGPU::EXP || MI.getDesc().mayStore()));
// LGKM may uses larger values
if (TSFlags & SIInstrFlags::LGKM_CNT) {
@@ -299,8 +302,21 @@ static void increaseCounters(Counters &D
Dst.Array[i] = std::max(Dst.Array[i], Src.Array[i]);
}
+bool SIInsertWaits::unorderedDefines(MachineInstr &MI) {
+
+ uint64_t TSFlags = TII->get(MI.getOpcode()).TSFlags;
+ if (TSFlags & SIInstrFlags::LGKM_CNT)
+ return true;
+
+ if (TSFlags & SIInstrFlags::EXP_CNT)
+ return ExpInstrTypesSeen == 3;
+
+ return false;
+}
+
Counters SIInsertWaits::handleOperands(MachineInstr &MI) {
+ bool UnorderedDefines = unorderedDefines(MI);
Counters Result = ZeroCounts;
// For each register affected by this
@@ -311,8 +327,11 @@ Counters SIInsertWaits::handleOperands(M
RegInterval Interval = getRegInterval(Op);
for (unsigned j = Interval.first; j < Interval.second; ++j) {
- if (Op.isDef())
+ if (Op.isDef()) {
increaseCounters(Result, UsedRegs[j]);
+ if (UnorderedDefines)
+ increaseCounters(Result, DefinedRegs[j]);
+ }
if (Op.isUse())
increaseCounters(Result, DefinedRegs[j]);
More information about the llvm-commits
mailing list