[llvm] r180160 - Machine model: rewrite a tablegen loop to avoid comparing record pointers.
Andrew Trick
atrick at apple.com
Tue Apr 23 16:45:11 PDT 2013
Author: atrick
Date: Tue Apr 23 18:45:11 2013
New Revision: 180160
URL: http://llvm.org/viewvc/llvm-project?rev=180160&view=rev
Log:
Machine model: rewrite a tablegen loop to avoid comparing record pointers.
Modified:
llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=180160&r1=180159&r2=180160&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Tue Apr 23 18:45:11 2013
@@ -797,7 +797,6 @@ void SubtargetEmitter::ExpandProcResourc
RecVec SubResources;
if (PRVec[i]->isSubClassOf("ProcResGroup")) {
SubResources = PRVec[i]->getValueAsListOfDefs("Resources");
- std::sort(SubResources.begin(), SubResources.end(), LessRecord());
}
else {
SubResources.push_back(PRVec[i]);
@@ -808,15 +807,12 @@ void SubtargetEmitter::ExpandProcResourc
if (*PRI == PRVec[i] || !(*PRI)->isSubClassOf("ProcResGroup"))
continue;
RecVec SuperResources = (*PRI)->getValueAsListOfDefs("Resources");
- std::sort(SuperResources.begin(), SuperResources.end(), LessRecord());
RecIter SubI = SubResources.begin(), SubE = SubResources.end();
- RecIter SuperI = SuperResources.begin(), SuperE = SuperResources.end();
- for ( ; SubI != SubE && SuperI != SuperE; ++SuperI) {
- if (*SubI < *SuperI)
+ for( ; SubI != SubE; ++SubI) {
+ if (std::find(SuperResources.begin(), SuperResources.end(), *SubI)
+ == SuperResources.end()) {
break;
- else if (*SuperI < *SubI)
- continue;
- ++SubI;
+ }
}
if (SubI == SubE) {
PRVec.push_back(*PRI);
More information about the llvm-commits
mailing list