[PostRA_Scheduler]修复了超大测例卡死的bug

This commit is contained in:
2025-07-28 23:17:26 +08:00
parent da5c2bb41d
commit 434bcea98e

View File

@ -1,9 +1,9 @@
#include "PostRA_Scheduler.h"
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define MAX_SCHEDULING_BLOCK_SIZE 10000 // 限制调度块大小,避免过大导致性能问题
namespace sysy {
@ -306,6 +306,9 @@ void validateSchedule(const std::vector<MachineInstr*>& instr_list) {
void scheduleBlock(MachineBasicBlock* mbb) {
auto& instructions = mbb->getInstructions();
if (instructions.size() <= 1) return;
if (instructions.size() > MAX_SCHEDULING_BLOCK_SIZE) {
return; // 跳过超大块,防止卡住
}
std::vector<MachineInstr*> instr_list;
for (auto& instr : instructions) {