Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comment
  • Loading branch information
kripken committed Oct 27, 2023
commit 3711eb1cfc5df81e3315a5c5669683da93495545
10 changes: 7 additions & 3 deletions src/passes/OnceReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ struct OnceReduction : public Pass {
if (auto* call = payload->dynCast<Call>()) {
if (optInfo.onceFuncs.at(call->target).is()) {
// All this "once" function does is call another. We do not need the
// early-exit logic in this one, then, because of the following logic.
// We are comparing these forms:
// early-exit logic in this one, then, because of the following
// reasoning. We are comparing these forms:
//
// // BEFORE
// function foo() {
Expand All @@ -517,7 +517,11 @@ struct OnceReduction : public Pass {
// 1. foo has been called before. Then we early-exit in BEFORE, and
// in AFTER we call bar which will early-exit (since foo was
// called, which means bar was at least entered, which set its
// global).
// global; bar might be on the stack, if it called up, so it has
// not necessarily fully executed - this is a tricky situation to
// handle in general, like recursive imports of modules in various
// languages - but we do not bar has been *entered*, which means
// the global was set).
// 2. foo has never been called before. In this case in BEFORE we set
// the global and call bar, and in AFTER we also call bar.
//
Expand Down