MI-Sched: handle ReadAdvance latencies as used by Swift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick 2013-06-17 21:45:18 +00:00
parent ad626132a9
commit 71b9d94d6b

View File

@ -201,7 +201,10 @@ unsigned TargetSchedModel::computeOperandLatency(
if (UseDesc->NumReadAdvanceEntries == 0)
return Latency;
unsigned UseIdx = findUseIdx(UseMI, UseOperIdx);
return Latency - STI->getReadAdvanceCycles(UseDesc, UseIdx, WriteID);
int Advance = STI->getReadAdvanceCycles(UseDesc, UseIdx, WriteID);
if (Advance > 0 && (unsigned)Advance > Latency) // unsigned wrap
return 0;
return Latency - Advance;
}
// If DefIdx does not exist in the model (e.g. implicit defs), then return
// unit latency (defaultDefLatency may be too conservative).