This commit is contained in:
Chris Fallin 2023-02-25 22:52:59 -08:00
parent b76e7758b7
commit ce09169375
2 changed files with 9 additions and 1 deletions

View file

@ -56,6 +56,10 @@ struct BlockVisitor<'a, V: Visitor> {
}
impl<'a, V: Visitor> BlockVisitor<'a, V> {
fn new(body: &'a FunctionBody, trees: &'a Trees, visitor: V) -> Self {
log::trace!(
"localify: running on:\n{}",
body.display_verbose("| ", None)
);
Self {
body,
trees,
@ -70,6 +74,9 @@ impl<'a, V: Visitor> BlockVisitor<'a, V> {
self.visitor.pre_term();
for &inst in self.body.blocks[block].insts.iter().rev() {
if self.trees.owner.contains_key(&inst) {
continue;
}
self.visitor.post_inst(inst);
self.visit_inst(inst, /* root = */ true);
self.visitor.pre_inst(inst);
@ -223,7 +230,7 @@ impl<'a> Context<'a> {
}
}
self.points = point;
self.points = point + 1;
}
fn allocate(&mut self) {

View file

@ -204,6 +204,7 @@ impl<'a> WasmFuncBackend<'a> {
match &self.body.values[value] {
&ValueDef::Operator(ref op, ref args, ref tys) => {
for &arg in &args[..] {
let arg = self.body.resolve_alias(arg);
if self.trees.owner.contains_key(&arg) {
log::trace!(" -> arg {} is owned", arg);
self.lower_inst(arg, /* root = */ false, func);