Shaders/ir: exclude unreachable blocks from preds and multi_entry_loop #712
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!712
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-712"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AscilCH on GitHub · 2026-11-25 05:20 UTC · original
AscilCH:fix/shader-ir-unreachable-preds-panic→main· +60 −4 · 1 files · 1 commits · openSummary
Fixes a guaranteed SSA-construction panic when a shader contains unreachable blocks with edges into live blocks (
crates/victory-shader/src/ir.rs):link()previously added predecessors from all blocks inblocks, including blocks unreachable from entry block0(such as dead instructions between an unconditionals_branchand its target, dead code afters_endpgm, or blocks orphaned by CFG transforms).rename()only computesouts[b]for blocks inreverse_postorder(&blocks). Any live block with an unreachable predecessor sawlookup(&outs[dead], reg) == NONE(Value(u32::MAX)), trippingdebug_assert!(!phi.args.contains(&NONE))/debug_assert_ne!(*v, NONE)in debug builds or causing an out-of-bounds panic inremove_trivial_phis()in release builds (and breaking entry block0inputs if an unreachable block targeted offset0).link()now computes reachability from block0viareverse_postorder, clears unreachable blocks (insts,phis,exit = Exit::End), and only populatespredsfrom reachable blocks.split_irreducible()now passes the reachable-block mask instead ofvec![true; blocks.len()]tomulti_entry_loop().Verification
cargo test -p victory-shader --locked -- ir::tests: 9 passed, 0 failed (including 2 new regression tests for dead fallthrough into a live block and dead branch targeting entry block0)cargo test -p victory-shader --locked -- ir::tests structure::tests resource::tests emit::lower::tests: 67 passed, 0 failed, 1 ignoredcargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean (0 warnings)cargo xtask policy:169 files ok(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.