diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 570ed4aadab7..167c05f9ef4e 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1012,17 +1012,13 @@ unsigned SwingSchedulerDAG::calculateResMII() { }); for (unsigned C = 0; C < NumCycles; ++C) while (RI != RE) { - if ((*RI++)->canReserveResources(*MI)) { + if ((*RI)->canReserveResources(*MI)) { + (*RI)->reserveResources(*MI); ++ReservedCycles; break; } + RI++; } - // Start reserving resources using existing DFAs. - for (unsigned C = 0; C < ReservedCycles; ++C) { - --RI; - (*RI)->reserveResources(*MI); - } - LLVM_DEBUG(dbgs() << "ReservedCycles:" << ReservedCycles << ", NumCycles:" << NumCycles << "\n"); // Add new DFAs, if needed, to reserve resources. diff --git a/llvm/test/CodeGen/PowerPC/sms-iterator.ll b/llvm/test/CodeGen/PowerPC/sms-iterator.ll index ec8067999968..1210ed98b5b5 100644 --- a/llvm/test/CodeGen/PowerPC/sms-iterator.ll +++ b/llvm/test/CodeGen/PowerPC/sms-iterator.ll @@ -5,7 +5,7 @@ %0 = type { i32, [16 x double] } -; CHECK: MII = 7 MAX_II = 17 +; CHECK: MII = 8 MAX_II = 18 define dso_local fastcc void @_ZN3povL9polysolveEiPdS0_() unnamed_addr #0 { br label %1