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

Function compute_preds

crates/rustc_codegen_spirv/src/linker/inline.rs:1053–1065  ·  view source on GitHub ↗
(blocks: &[Block])

Source from the content-addressed store, hash-verified

1051}
1052
1053fn compute_preds(blocks: &[Block]) -> Vec<Vec<usize>> {
1054 let mut result = vec![vec![]; blocks.len()];
1055 for (source_idx, source) in blocks.iter().enumerate() {
1056 for dest_id in outgoing_edges(source) {
1057 let dest_idx = blocks
1058 .iter()
1059 .position(|b| b.label_id().unwrap() == dest_id)
1060 .unwrap();
1061 result[dest_idx].push(source_idx);
1062 }
1063 }
1064 result
1065}
1066
1067/// Helper for adjusting `OpPhi` source label IDs, when the terminator of the
1068/// `original_label_id`-labeled block got moved to `blocks[original_block_idx]`.

Callers 1

fuse_trivial_branchesFunction · 0.70

Calls 2

outgoing_edgesFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected