[llvm] r184135 - MI-Sched: handle ReadAdvance latencies as used by Swift.
Andrew Trick
atrick at apple.com
Mon Jun 17 14:45:19 PDT 2013
Author: atrick
Date: Mon Jun 17 16:45:18 2013
New Revision: 184135
URL: http://llvm.org/viewvc/llvm-project?rev=184135&view=rev
Log:
MI-Sched: handle ReadAdvance latencies as used by Swift.
Modified:
llvm/trunk/lib/CodeGen/TargetSchedule.cpp
Modified: llvm/trunk/lib/CodeGen/TargetSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetSchedule.cpp?rev=184135&r1=184134&r2=184135&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetSchedule.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetSchedule.cpp Mon Jun 17 16:45:18 2013
@@ -201,7 +201,10 @@ unsigned TargetSchedModel::computeOperan
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).
More information about the llvm-commits
mailing list