[llvm] r328126 - [SchedModel] Use CodeGenSchedClass::isKeyEqual instead of duplicating code. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 21 10:57:21 PDT 2018
Author: rksimon
Date: Wed Mar 21 10:57:21 2018
New Revision: 328126
URL: http://llvm.org/viewvc/llvm-project?rev=328126&view=rev
Log:
[SchedModel] Use CodeGenSchedClass::isKeyEqual instead of duplicating code. NFCI.
Modified:
llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
llvm/trunk/utils/TableGen/CodeGenSchedule.h
Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.cpp?rev=328126&r1=328125&r2=328126&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenSchedule.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenSchedule.cpp Wed Mar 21 10:57:21 2018
@@ -652,12 +652,9 @@ void CodeGenSchedModels::collectSchedCla
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;
}
Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.h?rev=328126&r1=328125&r2=328126&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenSchedule.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenSchedule.h Wed Mar 21 10:57:21 2018
@@ -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;
}
More information about the llvm-commits
mailing list