enable DCE remove phi

This commit is contained in:
2024-10-24 07:02:50 +00:00
parent 86a835c6ef
commit 5127c269fc

View File

@ -53,6 +53,15 @@ void ConductDCEForFunction(std::shared_ptr<FunctionDefItem> func) {
block->actions.push_back(act);
}
}
std::vector<std::string> phi_to_remove;
for (auto [key, phi_act] : block->phi_map) {
if (phi_act->marked_as_useless) {
phi_to_remove.push_back(key);
}
}
for (auto key : phi_to_remove) {
block->phi_map.erase(key);
}
}
}
std::shared_ptr<ModuleItem> DCE(std::shared_ptr<ModuleItem> src) {