You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add CFG post-dominator computation and continue construct validation
Add post-dominator computation to ControlFlowGraph by running the
standard dominator algorithm on the reversed CFG with a pseudo-exit
node. Post-dominators are used to validate that in each loop's continue
construct, the back-edge block structurally post-dominates the continue
target, ensuring the continue construct is well-structured.
Changes:
- cfg_analysis.rs: Add post_dominators field, compute_post_dominators()
using reversed CFG with pseudo-exit, and post_dominates() query method
- error.rs: Add ContinueConstructNotPostDominated error variant
- rules/cfg.rs: Add ContinueConstructPostDominanceRule that validates
back-edge blocks post-dominate their continue targets
- tests: 3 unit tests for post-dominator computation (linear, diamond,
multiple exits) and 3 integration tests (single-block continue,
multi-block continue, negative case with split back edges)
Copy file name to clipboardExpand all lines: rust/spirv-tools-core/src/validation/error.rs
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2747,6 +2747,18 @@ pub enum ValidationError {
2747
2747
/// The continue target block.
2748
2748
continue_target:Id,
2749
2749
},
2750
+
/// The back-edge block does not structurally post-dominate the continue target.
2751
+
#[error("back-edge block {back_edge_block:?} does not post-dominate continue target {continue_target:?} of loop header {header:?} in function {function:?}")]
2752
+
ContinueConstructNotPostDominated{
2753
+
/// The function containing the loop.
2754
+
function:Id,
2755
+
/// The loop header block.
2756
+
header:Id,
2757
+
/// The continue target block.
2758
+
continue_target:Id,
2759
+
/// The back-edge block.
2760
+
back_edge_block:Id,
2761
+
},
2750
2762
/// Unroll and DontUnroll loop controls are both specified.
2751
2763
#[error("Unroll and DontUnroll loop controls must not both be specified")]
0 commit comments