mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
spv-in: fix classification of back edges
fix clippy another fix
This commit is contained in:
committed by
Dzmitry Malyshau
parent
0945889dd7
commit
889e487b62
@@ -81,6 +81,14 @@ impl FlowGraph {
|
||||
continue_block_index,
|
||||
ControlFlowEdgeType::ForwardContinue,
|
||||
);
|
||||
|
||||
// Back edge
|
||||
self.flow[continue_block_index].ty = Some(ControlFlowNodeType::Back);
|
||||
self.flow.add_edge(
|
||||
continue_block_index,
|
||||
source_node_index,
|
||||
ControlFlowEdgeType::Back,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,11 +98,13 @@ impl FlowGraph {
|
||||
Terminator::Branch { target_id } => {
|
||||
let target_node_index = block_to_node[&target_id];
|
||||
|
||||
self.flow.add_edge(
|
||||
source_node_index,
|
||||
target_node_index,
|
||||
ControlFlowEdgeType::Forward,
|
||||
);
|
||||
if self.flow[source_node_index].ty != Some(ControlFlowNodeType::Back) {
|
||||
self.flow.add_edge(
|
||||
source_node_index,
|
||||
target_node_index,
|
||||
ControlFlowEdgeType::Forward,
|
||||
);
|
||||
}
|
||||
}
|
||||
Terminator::BranchConditional {
|
||||
true_id, false_id, ..
|
||||
@@ -158,14 +168,6 @@ impl FlowGraph {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Back
|
||||
if self.flow[node_target_index].ty == Some(ControlFlowNodeType::Loop)
|
||||
&& self.flow[node_source_index].id > self.flow[node_target_index].id
|
||||
{
|
||||
self.flow[node_source_index].ty = Some(ControlFlowNodeType::Back);
|
||||
self.flow[edge_index] = ControlFlowEdgeType::Back;
|
||||
}
|
||||
|
||||
let mut target_incoming_edges = self
|
||||
.flow
|
||||
.neighbors_directed(node_target_index, Direction::Incoming)
|
||||
|
||||
Reference in New Issue
Block a user