This commit is contained in:
Chris Fallin 2022-11-29 19:49:22 -08:00
parent 4e3fb51aa9
commit 8caba239fa
No known key found for this signature in database
GPG key ID: 31649E4FE65EB465
2 changed files with 8 additions and 1 deletions

View file

@ -1156,11 +1156,12 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
.collect::<Vec<_>>(); .collect::<Vec<_>>();
self.locals.start_block(*el, self.reachable); self.locals.start_block(*el, self.reachable);
self.cur_block = *el; self.cur_block = *el;
self.reachable = *head_reachable;
self.emit_branch(*out, &else_result_values[..]); self.emit_branch(*out, &else_result_values[..]);
assert_eq!(self.op_stack.len(), *start_depth); assert_eq!(self.op_stack.len(), *start_depth);
} }
self.cur_block = *out; self.cur_block = *out;
self.reachable = *head_reachable || self.reachable || *merge_reachable; self.reachable = *head_reachable || was_reachable || *merge_reachable;
self.locals.seal_block_preds(*out, &mut self.body); self.locals.seal_block_preds(*out, &mut self.body);
self.locals.start_block(*out, was_reachable); self.locals.start_block(*out, was_reachable);
self.push_block_params(results.len()); self.push_block_params(results.len());
@ -1455,6 +1456,11 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
} }
fn emit_unreachable(&mut self) { fn emit_unreachable(&mut self) {
log::trace!(
"emit_unreachable: cur_block {} reachable {}",
self.cur_block,
self.reachable
);
if self.reachable { if self.reachable {
self.body.end_block(self.cur_block, Terminator::Unreachable); self.body.end_block(self.cur_block, Terminator::Unreachable);
self.reachable = false; self.reachable = false;

View file

@ -170,6 +170,7 @@ impl FunctionBody {
} }
pub fn end_block(&mut self, block: Block, terminator: Terminator) { pub fn end_block(&mut self, block: Block, terminator: Terminator) {
log::trace!("block {} terminator {:?}", block, terminator);
terminator.visit_successors(|succ| { terminator.visit_successors(|succ| {
self.add_edge(block, succ); self.add_edge(block, succ);
}); });