MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / compute_preds

Function compute_preds

crates/rustc_codegen_spirv/src/linker/mem2reg.rs:70–84  ·  view source on GitHub ↗
(blocks: &[Block], reachable_blocks: &[bool])

Source from the content-addressed store, hash-verified

68}
69
70fn compute_preds(blocks: &[Block], reachable_blocks: &[bool]) -> Vec<Vec<usize>> {
71 let mut result = vec![vec![]; blocks.len()];
72 // Do not count unreachable blocks as valid preds of blocks
73 for (source_idx, source) in blocks
74 .iter()
75 .enumerate()
76 .filter(|&(b, _)| reachable_blocks[b])
77 {
78 for dest_id in outgoing_edges(source) {
79 let dest_idx = label_to_index(blocks, dest_id);
80 result[dest_idx].push(source_idx);
81 }
82 }
83 result
84}
85
86// Paper: A Simple, Fast Dominance Algorithm
87// https://www.cs.rice.edu/~keith/EMBED/dom.pdf

Callers 1

mem2regFunction · 0.70

Calls 3

outgoing_edgesFunction · 0.85
label_to_indexFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected