deploy-20250820-3 #1

Merged
gh0s7 merged 352 commits from deploy-20250820-3 into master 2025-08-20 21:20:33 +08:00
Showing only changes of commit ce4d4b5f5b - Show all commits

View File

@@ -109,6 +109,28 @@ public:
}
// PHI指令消除相关方法
static void eliminateRedundantPhisInFunction(Function* func){
std::vector<Instruction *> toDelete;
for (auto &bb : func->getBasicBlocks()) {
for (auto &inst : bb->getInstructions()) {
if (auto phi = dynamic_cast<PhiInst *>(inst.get())) {
auto incoming = phi->getIncomingValues();
if (incoming.size() == 1) {
Value *singleVal = incoming[0].first;
inst->replaceAllUsesWith(singleVal);
toDelete.push_back(inst.get());
}
}
else
break; // 只处理Phi指令
}
}
for (auto *phi : toDelete) {
usedelete(phi);
}
}
//该实现参考了libdivide的算法
static std::pair<int, int> computeMulhMagicNumbers(int divisor) {