Skip to content

Commit 18e096c

Browse files
committed
finalize new drops in SimplifyLocals
1 parent ee7538a commit 18e096c

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/passes/SimplifyLocals.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct SetLocalRemover : public PostWalker<SetLocalRemover> {
6464
} else {
6565
Drop* drop = ExpressionManipulator::convert<SetLocal, Drop>(curr);
6666
drop->value = value;
67+
drop->finalize();
6768
}
6869
}
6970
}
@@ -268,6 +269,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals>>
268269
auto* previousValue = previous->value;
269270
Drop* drop = ExpressionManipulator::convert<SetLocal, Drop>(previous);
270271
drop->value = previousValue;
272+
drop->finalize();
271273
self->sinkables.erase(found);
272274
self->anotherCycle = true;
273275
}

test/passes/simplify-locals-nostructure.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,10 @@
6262
(get_local $b)
6363
)
6464
)
65+
(func $no-unreachable (type $0)
66+
(local $x i32)
67+
(drop
68+
(unreachable)
69+
)
70+
)
6571
)

test/passes/simplify-locals-nostructure.wast

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,13 @@
2828
)
2929
(drop (get_local $b))
3030
)
31+
(func $no-unreachable
32+
(local $x i32)
33+
(drop
34+
(tee_local $x
35+
(unreachable)
36+
)
37+
)
38+
)
3139
)
3240

0 commit comments

Comments
 (0)