Skip to content

Commit 8f02936

Browse files
authored
[NFC][TableGen] Eliminate use of ConstRecIter from SubtargetEmitter (#130162)
- Eliminate use of `ConstRecIter` from `expandProcResources` by using `all_of()` to simplify the code.
1 parent 3c71f71 commit 8f02936

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/utils/TableGen/SubtargetEmitter.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,9 +1029,9 @@ void SubtargetEmitter::expandProcResources(
10291029
for (unsigned I = 0, E = PRVec.size(); I != E; ++I) {
10301030
const Record *PRDef = PRVec[I];
10311031
ConstRecVec SubResources;
1032-
if (PRDef->isSubClassOf("ProcResGroup"))
1032+
if (PRDef->isSubClassOf("ProcResGroup")) {
10331033
SubResources = PRDef->getValueAsListOfDefs("Resources");
1034-
else {
1034+
} else {
10351035
SubResources.push_back(PRDef);
10361036
PRDef = SchedModels.findProcResUnits(PRDef, PM, PRDef->getLoc());
10371037
for (const Record *SubDef = PRDef;
@@ -1053,13 +1053,11 @@ void SubtargetEmitter::expandProcResources(
10531053
if (PR == PRDef || !PR->isSubClassOf("ProcResGroup"))
10541054
continue;
10551055
ConstRecVec SuperResources = PR->getValueAsListOfDefs("Resources");
1056-
ConstRecIter SubI = SubResources.begin(), SubE = SubResources.end();
1057-
for (; SubI != SubE; ++SubI) {
1058-
if (!is_contained(SuperResources, *SubI)) {
1059-
break;
1060-
}
1061-
}
1062-
if (SubI == SubE) {
1056+
bool AllContained =
1057+
all_of(SubResources, [SuperResources](const Record *SubResource) {
1058+
return is_contained(SuperResources, SubResource);
1059+
});
1060+
if (AllContained) {
10631061
PRVec.push_back(PR);
10641062
ReleaseAtCycles.push_back(ReleaseAtCycles[I]);
10651063
AcquireAtCycles.push_back(AcquireAtCycles[I]);

0 commit comments

Comments
 (0)