shader: Fix splits on blocks using indirect branches

This commit is contained in:
ReinUsesLisp 2021-04-04 20:00:34 -03:00 committed by ameerj
parent ffca21487f
commit 9e6fe430bd
3 changed files with 38 additions and 17 deletions

View file

@ -21,7 +21,7 @@ void RemoveUnreachableBlocks(IR::Program& program) {
if (program.blocks.size() == program.post_order_blocks.size()) {
return;
}
const auto begin{std::next(program.blocks.begin())};
const auto begin{program.blocks.begin() + 1};
const auto end{program.blocks.end()};
const auto pred{[](IR::Block* block) { return block->ImmediatePredecessors().empty(); }};
program.blocks.erase(std::remove_if(begin, end, pred), end);