[SchedModel] Use CodeGenSchedClass::isKeyEqual instead of duplicating code. NFCI.

llvm-svn: 328126
This commit is contained in:
Simon Pilgrim 2018-03-21 17:57:21 +00:00
parent 430aa7405f
commit 4cca3b190b
2 changed files with 4 additions and 6 deletions

View File

@ -652,12 +652,9 @@ void CodeGenSchedModels::collectSchedClasses() {
unsigned CodeGenSchedModels::findSchedClassIdx(Record *ItinClassDef,
ArrayRef<unsigned> Writes,
ArrayRef<unsigned> Reads) const {
for (SchedClassIter I = schedClassBegin(), E = schedClassEnd(); I != E; ++I) {
if (I->ItinClassDef == ItinClassDef && makeArrayRef(I->Writes) == Writes &&
makeArrayRef(I->Reads) == Reads) {
for (SchedClassIter I = schedClassBegin(), E = schedClassEnd(); I != E; ++I)
if (I->isKeyEqual(ItinClassDef, Writes, Reads))
return I - schedClassBegin();
}
}
return 0;
}

View File

@ -141,7 +141,8 @@ struct CodeGenSchedClass {
CodeGenSchedClass(): Index(0), ItinClassDef(nullptr) {}
bool isKeyEqual(Record *IC, ArrayRef<unsigned> W, ArrayRef<unsigned> R) {
bool isKeyEqual(Record *IC, ArrayRef<unsigned> W,
ArrayRef<unsigned> R) const {
return ItinClassDef == IC && makeArrayRef(Writes) == W &&
makeArrayRef(Reads) == R;
}