summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenSchedule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/TableGen/CodeGenSchedule.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenSchedule.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 446a641abec..a21e44b1970 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -800,25 +800,25 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) {
SC.Writes = SchedClasses[OldSCIdx].Writes;
SC.Reads = SchedClasses[OldSCIdx].Reads;
SC.ProcIndices.push_back(0);
- // Map each Instr to this new class.
- // Note that InstDefs may be a smaller list than InstRWDef's "Instrs".
- Record *RWModelDef = InstRWDef->getValueAsDef("SchedModel");
- SmallSet<unsigned, 4> RemappedClassIDs;
- for (Record *InstDef : InstDefs) {
- if (OldSCIdx && RemappedClassIDs.insert(OldSCIdx).second) {
- for (Record *OldRWDef : SchedClasses[OldSCIdx].InstRWs) {
- if (OldRWDef->getValueAsDef("SchedModel") == RWModelDef) {
+ // If we had an old class, copy it's InstRWs to this new class.
+ if (OldSCIdx) {
+ Record *RWModelDef = InstRWDef->getValueAsDef("SchedModel");
+ for (Record *OldRWDef : SchedClasses[OldSCIdx].InstRWs) {
+ if (OldRWDef->getValueAsDef("SchedModel") == RWModelDef) {
+ for (Record *InstDef : InstDefs) {
PrintFatalError(OldRWDef->getLoc(), "Overlapping InstRW def " +
InstDef->getName() + " also matches " +
OldRWDef->getValue("Instrs")->getValue()->getAsString());
}
- assert(OldRWDef != InstRWDef &&
- "SchedClass has duplicate InstRW def");
- SC.InstRWs.push_back(OldRWDef);
}
+ assert(OldRWDef != InstRWDef &&
+ "SchedClass has duplicate InstRW def");
+ SC.InstRWs.push_back(OldRWDef);
}
- InstrClassMap[InstDef] = SCIdx;
}
+ // Map each Instr to this new class.
+ for (Record *InstDef : InstDefs)
+ InstrClassMap[InstDef] = SCIdx;
SC.InstRWs.push_back(InstRWDef);
}
}
OpenPOWER on IntegriCloud