@@ -806,15 +806,11 @@ void SIScheduleBlockCreator::colorComputeReservedDependencies() {
806
806
CurrentTopDownReservedDependencyColoring[SU->NodeNum ] =
807
807
*SUColors.begin ();
808
808
else {
809
- std::map<std::set<unsigned >, unsigned >::iterator Pos =
810
- ColorCombinations.find (SUColors);
811
- if (Pos != ColorCombinations.end ()) {
812
- CurrentTopDownReservedDependencyColoring[SU->NodeNum ] = Pos->second ;
813
- } else {
814
- CurrentTopDownReservedDependencyColoring[SU->NodeNum ] =
815
- NextNonReservedID;
816
- ColorCombinations[SUColors] = NextNonReservedID++;
817
- }
809
+ auto [Pos, Inserted] =
810
+ ColorCombinations.try_emplace (SUColors, NextNonReservedID);
811
+ if (Inserted)
812
+ ++NextNonReservedID;
813
+ CurrentTopDownReservedDependencyColoring[SU->NodeNum ] = Pos->second ;
818
814
}
819
815
}
820
816
@@ -1176,14 +1172,15 @@ void SIScheduleBlockCreator::createBlocksForVariant(SISchedulerBlockCreatorVaria
1176
1172
for (unsigned i = 0 , e = DAGSize; i != e; ++i) {
1177
1173
SUnit *SU = &DAG->SUnits [i];
1178
1174
unsigned Color = CurrentColoring[SU->NodeNum ];
1179
- if (RealID.find (Color) == RealID.end ()) {
1175
+ auto [It, Inserted] = RealID.try_emplace (Color);
1176
+ if (Inserted) {
1180
1177
int ID = CurrentBlocks.size ();
1181
1178
BlockPtrs.push_back (std::make_unique<SIScheduleBlock>(DAG, this , ID));
1182
1179
CurrentBlocks.push_back (BlockPtrs.rbegin ()->get ());
1183
- RealID[Color] = ID;
1180
+ It-> second = ID;
1184
1181
}
1185
- CurrentBlocks[RealID[Color] ]->addUnit (SU);
1186
- Node2CurrentBlock[SU->NodeNum ] = RealID[Color] ;
1182
+ CurrentBlocks[It-> second ]->addUnit (SU);
1183
+ Node2CurrentBlock[SU->NodeNum ] = It-> second ;
1187
1184
}
1188
1185
1189
1186
// Build dependencies between blocks.
0 commit comments