[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

@@ -350,7 +350,11 @@ private:
std::set<Value*>& visited
);
bool isBasicInductionVariable(Value* val, Loop* loop);
bool hasSimpleMemoryPattern(Loop* loop); // 简单的内存模式检查
// ========== 循环不变量分析辅助方法 ==========
bool isInvariantOperands(Instruction* inst, Loop* loop, const std::unordered_set<Value*>& invariants);
bool isMemoryLocationModifiedInLoop(Value* ptr, Loop* loop);
bool isMemoryLocationLoadedInLoop(Value* ptr, Loop* loop, Instruction* excludeInst = nullptr);
bool isPureFunction(Function* calledFunc);
};
} // namespace sysy