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

llvm-svn: 184135
This commit is contained in:
Andrew Trick 2013-06-17 21:45:18 +00:00
parent 3296a5c808
commit 5d4861867a
1 changed files with 4 additions and 1 deletions

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).