@@ -1545,24 +1545,22 @@ void HoistSpillHelper::runHoistSpills(
1545
1545
for (MachineDomTreeNode *Child : (*RIt)->children ()) {
1546
1546
if (!SpillsInSubTreeMap.contains (Child))
1547
1547
continue ;
1548
- // The stmt "SpillsInSubTree = SpillsInSubTreeMap[*RIt].first" below
1549
- // should be placed before getting the begin and end iterators of
1548
+ // The stmt:
1549
+ // "auto &[SpillsInSubTree, SubTreeCost] = SpillsInSubTreeMap[*RIt]"
1550
+ // below should be placed before getting the begin and end iterators of
1550
1551
// SpillsInSubTreeMap[Child].first, or else the iterators may be
1551
1552
// invalidated when SpillsInSubTreeMap[*RIt] is seen the first time
1552
1553
// and the map grows and then the original buckets in the map are moved.
1553
- SmallPtrSet<MachineDomTreeNode *, 16 > &SpillsInSubTree =
1554
- SpillsInSubTreeMap[*RIt].first ;
1555
- BlockFrequency &SubTreeCost = SpillsInSubTreeMap[*RIt].second ;
1556
- SubTreeCost += SpillsInSubTreeMap[Child].second ;
1557
- auto BI = SpillsInSubTreeMap[Child].first .begin ();
1558
- auto EI = SpillsInSubTreeMap[Child].first .end ();
1554
+ auto &[SpillsInSubTree, SubTreeCost] = SpillsInSubTreeMap[*RIt];
1555
+ auto ChildIt = SpillsInSubTreeMap.find (Child);
1556
+ SubTreeCost += ChildIt->second .second ;
1557
+ auto BI = ChildIt->second .first .begin ();
1558
+ auto EI = ChildIt->second .first .end ();
1559
1559
SpillsInSubTree.insert (BI, EI);
1560
- SpillsInSubTreeMap.erase (Child );
1560
+ SpillsInSubTreeMap.erase (ChildIt );
1561
1561
}
1562
1562
1563
- SmallPtrSet<MachineDomTreeNode *, 16 > &SpillsInSubTree =
1564
- SpillsInSubTreeMap[*RIt].first ;
1565
- BlockFrequency &SubTreeCost = SpillsInSubTreeMap[*RIt].second ;
1563
+ auto &[SpillsInSubTree, SubTreeCost] = SpillsInSubTreeMap[*RIt];
1566
1564
// No spills in subtree, simply continue.
1567
1565
if (SpillsInSubTree.empty ())
1568
1566
continue ;
0 commit comments