@@ -1849,26 +1849,21 @@ static void computeUberWeights(MutableArrayRef<UberRegSet> UberSets,
1849
1849
// Skip the first unallocatable set.
1850
1850
for (UberRegSet &S : UberSets.drop_front ()) {
1851
1851
// Initialize all unit weights in this set, and remember the max units/reg.
1852
- const CodeGenRegister *Reg = nullptr ;
1853
- unsigned MaxWeight = 0 , Weight = 0 ;
1854
- for (RegUnitIterator UnitI (S.Regs ); UnitI.isValid (); ++UnitI) {
1855
- if (Reg != UnitI.getReg ()) {
1856
- if (Weight > MaxWeight)
1857
- MaxWeight = Weight;
1858
- Reg = UnitI.getReg ();
1859
- Weight = 0 ;
1860
- }
1861
- if (!RegBank.getRegUnit (*UnitI).Artificial ) {
1862
- unsigned UWeight = RegBank.getRegUnit (*UnitI).Weight ;
1863
- if (!UWeight) {
1864
- UWeight = 1 ;
1865
- RegBank.increaseRegUnitWeight (*UnitI, UWeight);
1852
+ unsigned MaxWeight = 0 ;
1853
+ for (const CodeGenRegister *R : S.Regs ) {
1854
+ unsigned Weight = 0 ;
1855
+ for (unsigned U : R->getRegUnits ()) {
1856
+ if (!RegBank.getRegUnit (U).Artificial ) {
1857
+ unsigned UWeight = RegBank.getRegUnit (U).Weight ;
1858
+ if (!UWeight) {
1859
+ UWeight = 1 ;
1860
+ RegBank.increaseRegUnitWeight (U, UWeight);
1861
+ }
1862
+ Weight += UWeight;
1866
1863
}
1867
- Weight += UWeight;
1868
1864
}
1865
+ MaxWeight = std::max (MaxWeight, Weight);
1869
1866
}
1870
- if (Weight > MaxWeight)
1871
- MaxWeight = Weight;
1872
1867
if (S.Weight != MaxWeight) {
1873
1868
LLVM_DEBUG ({
1874
1869
dbgs () << " UberSet " << &S - UberSets.begin () << " Weight "
0 commit comments