[midend-LICM][fix]修复循环不变量的识别逻辑

This commit is contained in:
rain2133
2025-08-17 01:19:44 +08:00
parent e32585fd25
commit d83dc7a2e7
4 changed files with 300 additions and 34 deletions

View File

@@ -55,10 +55,11 @@ bool LICMContext::hoistInstructions() {
}
}
// 检查是否全部排序,若未全部排序,说明有环(理论上不会)
// 检查是否全部排序,若未全部排序,打印错误信息
// 这可能是因为存在循环依赖或其他问题导致无法完成拓扑排序
if (sorted.size() != workSet.size()) {
if (DEBUG)
std::cerr << "LICM: Topological sort failed, possible dependency cycle." << std::endl;
std::cout << "LICM: Topological sort failed, possible dependency cycle." << std::endl;
return false;
}