Skip to content

Commit b2b2780

Browse files
committed
better
1 parent b9d87b1 commit b2b2780

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/passes/Inlining.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ struct FunctionInfoScanner
198198
: public WalkerPass<PostWalker<FunctionInfoScanner>> {
199199
bool isFunctionParallel() override { return true; }
200200

201+
bool modifiesBinaryenIR() override { return false; }
202+
201203
FunctionInfoScanner(NameInfoMap& infos) : infos(infos) {}
202204

203205
std::unique_ptr<Pass> create() override {
@@ -323,6 +325,8 @@ struct InliningState {
323325
struct Planner : public WalkerPass<TryDepthWalker<Planner>> {
324326
bool isFunctionParallel() override { return true; }
325327

328+
bool modifiesBinaryenIR() override { return false; }
329+
326330
Planner(InliningState* state) : state(state) {}
327331

328332
std::unique_ptr<Pass> create() override {
@@ -688,6 +692,10 @@ static void updateAfterInlining(Module* module, Function* into) {
688692
// Inlining unreachable contents can make things in the function we inlined
689693
// into unreachable.
690694
ReFinalize().walkFunctionInModule(into, module);
695+
// New locals we added may require fixups for nondefaultability. We do this
696+
// here and not in the main pass (or its subpasses) so that we only do it
697+
// where needed.
698+
TypeUpdating::handleNonDefaultableLocals(into, *module);
691699
}
692700

693701
static void doInlining(Module* module,
@@ -707,6 +715,9 @@ using ChosenActions = std::unordered_map<Name, std::vector<InliningAction>>;
707715
struct DoInlining : public Pass {
708716
bool isFunctionParallel() override { return true; }
709717

718+
// We do this only where we inline, inside updateAfterInlining().
719+
bool requiresNonNullableLocalFixups() override { return false; }
720+
710721
std::unique_ptr<Pass> create() override {
711722
return std::make_unique<DoInlining>(chosenActions);
712723
}

0 commit comments

Comments
 (0)