@@ -932,12 +932,11 @@ void MachineLICMImpl::InitRegPressure(MachineBasicBlock *BB) {
932932void MachineLICMImpl::UpdateRegPressure (const MachineInstr *MI,
933933 bool ConsiderUnseenAsDef) {
934934 auto Cost = calcRegisterCost (MI, /* ConsiderSeen=*/ true , ConsiderUnseenAsDef);
935- for (const auto &RPIdAndCost : Cost) {
936- unsigned Class = RPIdAndCost.first ;
937- if (static_cast <int >(RegPressure[Class]) < -RPIdAndCost.second )
935+ for (const auto &[Class, Weight] : Cost) {
936+ if (static_cast <int >(RegPressure[Class]) < -Weight)
938937 RegPressure[Class] = 0 ;
939938 else
940- RegPressure[Class] += RPIdAndCost. second ;
939+ RegPressure[Class] += Weight ;
941940 }
942941}
943942
@@ -1215,11 +1214,10 @@ bool MachineLICMImpl::IsCheapInstruction(MachineInstr &MI) const {
12151214// / given cost matrix can cause high register pressure.
12161215bool MachineLICMImpl::CanCauseHighRegPressure (
12171216 const SmallDenseMap<unsigned , int > &Cost, bool CheapInstr) {
1218- for (const auto &RPIdAndCost : Cost) {
1219- if (RPIdAndCost. second <= 0 )
1217+ for (const auto &[Class, Weight] : Cost) {
1218+ if (Weight <= 0 )
12201219 continue ;
12211220
1222- unsigned Class = RPIdAndCost.first ;
12231221 int Limit = RegLimit[Class];
12241222
12251223 // Don't hoist cheap instructions if they would increase register pressure,
@@ -1228,7 +1226,7 @@ bool MachineLICMImpl::CanCauseHighRegPressure(
12281226 return true ;
12291227
12301228 for (const auto &RP : BackTrace)
1231- if (static_cast <int >(RP[Class]) + RPIdAndCost. second >= Limit)
1229+ if (static_cast <int >(RP[Class]) + Weight >= Limit)
12321230 return true ;
12331231 }
12341232
@@ -1246,8 +1244,8 @@ void MachineLICMImpl::UpdateBackTraceRegPressure(const MachineInstr *MI) {
12461244
12471245 // Update register pressure of blocks from loop header to current block.
12481246 for (auto &RP : BackTrace)
1249- for (const auto &RPIdAndCost : Cost)
1250- RP[RPIdAndCost. first ] += RPIdAndCost. second ;
1247+ for (const auto &[Class, Weight] : Cost)
1248+ RP[Class ] += Weight ;
12511249}
12521250
12531251// / Return true if it is potentially profitable to hoist the given loop
0 commit comments