shader: seal SSA blocks once their predecessors are filled

This commit is contained in:
nmzik
2026-10-27 03:59:46 +01:00
parent 7eb8abb279
commit 3f9666acbb
2 changed files with 76 additions and 4 deletions
@@ -348,14 +348,20 @@ void VisitInstruction(Pass& pass, Block* block, Inst& inst) {
} // namespace
void RewriteToSsa(const BlockList& blocks) {
Pass pass;
Pass pass;
std::unordered_map<Block*, size_t> filled_predecessors;
for (auto* block: blocks) {
if (block->ImmPredecessors().empty()) {
pass.Seal(block);
}
for (auto& inst: *block) {
VisitInstruction(pass, block, inst);
}
}
for (auto* block: blocks) {
pass.Seal(block);
for (auto* successor: block->ImmSuccessors()) {
if (++filled_predecessors[successor] == successor->ImmPredecessors().size()) {
pass.Seal(successor);
}
}
}
}