spv-in flow: fix loop

This commit is contained in:
Matúš Talčík
2021-03-01 09:41:48 +01:00
committed by Dzmitry Malyshau
parent bb7105387d
commit 34c549d49d
3 changed files with 5 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![allow(dead_code)]
use super::error::Error;
///! see https://en.wikipedia.org/wiki/Control-flow_graph
@@ -394,19 +394,7 @@ impl FlowGraph {
};
Ok(result)
}
Some(ControlFlowNodeType::Continue) => {
let back_block = match node.terminator {
Terminator::Branch { target_id } => {
self.naga_traverse(self.block_to_node[&target_id], None)?
}
_ => return Err(Error::InvalidTerminator),
};
let mut result = node.block.clone();
result.extend(back_block);
result.push(crate::Statement::Continue);
Ok(result)
}
Some(ControlFlowNodeType::Continue) => Ok(node.block.clone()),
Some(ControlFlowNodeType::Back) => Ok(node.block.clone()),
Some(ControlFlowNodeType::Kill) => {
let mut result = node.block.clone();

View File

@@ -1,6 +1,7 @@
---
source: tests/snapshots.rs
expression: output
---
(
functions: [
@@ -878,7 +879,7 @@ expression: output
control_flags: (
bits: 1,
),
ref_count: 12,
ref_count: 11,
assignable_global: None,
),
(
@@ -1214,7 +1215,7 @@ expression: output
control_flags: (
bits: 1,
),
ref_count: 2,
ref_count: 1,
assignable_global: None,
),
(

View File

@@ -1107,11 +1107,6 @@ expression: output
pointer: 43,
value: 91,
),
Store(
pointer: 44,
value: 92,
),
Continue,
],
continuing: [
Store(