@@ -1985,18 +1985,14 @@ void CodeGenRegBank::computeRegUnitSets() {
1985
1985
if (!RC.Allocatable || RC.Artificial || !RC.GeneratePressureSet )
1986
1986
continue ;
1987
1987
1988
- // Speculatively grow the RegUnitSets to hold the new set.
1989
- RegUnitSet &RUSet = RegUnitSets.emplace_back ();
1990
- RUSet.Name = RC.getName ();
1991
-
1992
1988
// Compute a sorted list of units in this class.
1989
+ RegUnitSet RUSet;
1990
+ RUSet.Name = RC.getName ();
1993
1991
RC.buildRegUnitSet (*this , RUSet.Units );
1994
1992
1995
1993
// Find an existing RegUnitSet.
1996
- std::vector<RegUnitSet>::const_iterator SetI =
1997
- findRegUnitSet (RegUnitSets, RUSet);
1998
- if (SetI != std::prev (RegUnitSets.end ()))
1999
- RegUnitSets.pop_back ();
1994
+ if (findRegUnitSet (RegUnitSets, RUSet) == RegUnitSets.end ())
1995
+ RegUnitSets.push_back (std::move (RUSet));
2000
1996
}
2001
1997
2002
1998
if (RegUnitSets.empty ())
@@ -2042,28 +2038,23 @@ void CodeGenRegBank::computeRegUnitSets() {
2042
2038
if (Intersection.empty ())
2043
2039
continue ;
2044
2040
2045
- // Speculatively grow the RegUnitSets to hold the new set.
2046
- RegUnitSet &RUSet = RegUnitSets.emplace_back ();
2041
+ RegUnitSet RUSet;
2047
2042
RUSet.Name =
2048
2043
RegUnitSets[Idx].Name + " _with_" + RegUnitSets[SearchIdx].Name ;
2049
-
2050
2044
std::set_union (RegUnitSets[Idx].Units .begin (),
2051
2045
RegUnitSets[Idx].Units .end (),
2052
2046
RegUnitSets[SearchIdx].Units .begin (),
2053
2047
RegUnitSets[SearchIdx].Units .end (),
2054
2048
std::inserter (RUSet.Units , RUSet.Units .begin ()));
2055
2049
2056
2050
// Find an existing RegUnitSet, or add the union to the unique sets.
2057
- std::vector<RegUnitSet>::const_iterator SetI =
2058
- findRegUnitSet (RegUnitSets, RUSet);
2059
- if (SetI != std::prev (RegUnitSets.end ()))
2060
- RegUnitSets.pop_back ();
2061
- else {
2062
- LLVM_DEBUG (dbgs () << " UnitSet " << RegUnitSets.size () - 1 << " "
2051
+ if (findRegUnitSet (RegUnitSets, RUSet) == RegUnitSets.end ()) {
2052
+ LLVM_DEBUG (dbgs () << " UnitSet " << RegUnitSets.size () << " "
2063
2053
<< RUSet.Name << " :" ;
2064
2054
for (auto &U
2065
2055
: RUSet.Units ) printRegUnitName (U);
2066
2056
dbgs () << " \n " ;);
2057
+ RegUnitSets.push_back (std::move (RUSet));
2067
2058
}
2068
2059
}
2069
2060
}
0 commit comments