aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-06-09 15:20:23 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-06-09 15:20:23 +0000
commit068ecc15c08ce4692df51f2de2cf73e48e396c97 (patch)
tree49b74b9c88c9296b8aaf0967fae14379bfd48829 /utils
parent3ade978551927cfb0e6dd4e26f0768908b1898bb (diff)
downloadexternal_llvm-068ecc15c08ce4692df51f2de2cf73e48e396c97.zip
external_llvm-068ecc15c08ce4692df51f2de2cf73e48e396c97.tar.gz
external_llvm-068ecc15c08ce4692df51f2de2cf73e48e396c97.tar.bz2
tblgen: always lookup values from the original vector as it could be grown under our feet.
PR16281. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenSchedule.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp
index da16852..503dfc2 100644
--- a/utils/TableGen/CodeGenSchedule.cpp
+++ b/utils/TableGen/CodeGenSchedule.cpp
@@ -890,9 +890,9 @@ void CodeGenSchedModels::inferFromItinClass(Record *ItinClassDef,
/// Infer classes from per-processor InstReadWrite definitions.
void CodeGenSchedModels::inferFromInstRWs(unsigned SCIdx) {
- const RecVec &RWDefs = SchedClasses[SCIdx].InstRWs;
- for (RecIter RWI = RWDefs.begin(), RWE = RWDefs.end(); RWI != RWE; ++RWI) {
- const RecVec *InstDefs = Sets.expand(*RWI);
+ for (unsigned I = 0, E = SchedClasses[SCIdx].InstRWs.size(); I != E; ++I) {
+ Record *Rec = SchedClasses[SCIdx].InstRWs[I];
+ const RecVec *InstDefs = Sets.expand(Rec);
RecIter II = InstDefs->begin(), IE = InstDefs->end();
for (; II != IE; ++II) {
if (InstrClassMap[*II] == SCIdx)
@@ -903,10 +903,10 @@ void CodeGenSchedModels::inferFromInstRWs(unsigned SCIdx) {
if (II == IE)
continue;
IdxVec Writes, Reads;
- findRWs((*RWI)->getValueAsListOfDefs("OperandReadWrites"), Writes, Reads);
- unsigned PIdx = getProcModel((*RWI)->getValueAsDef("SchedModel")).Index;
+ findRWs(Rec->getValueAsListOfDefs("OperandReadWrites"), Writes, Reads);
+ unsigned PIdx = getProcModel(Rec->getValueAsDef("SchedModel")).Index;
IdxVec ProcIndices(1, PIdx);
- inferFromRW(Writes, Reads, SCIdx, ProcIndices);
+ inferFromRW(Writes, Reads, SCIdx, ProcIndices); // May mutate SchedClasses.
}
}