Skip to content

Commit

Permalink
[NFC] Improve OnceReduction comment (WebAssembly#6068)
Browse files Browse the repository at this point in the history
Followup to WebAssembly#6061
  • Loading branch information
kripken committed Oct 31, 2023
1 parent fad0698 commit c82627e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/passes/OnceReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,13 @@ struct OnceReduction : public Pass {
// the global and call bar, and in AFTER we also call bar.
//
// Thus, the behavior is the same, and we can remove the early-exit
// lines.
// lines. Note that things would be quite different if we had any code
// after the call to bar(), as then that code would no longer be
// guarded by an early-exit (and could end up called more than once).
// That is, this optimization depends on the fact that bar's call from
// foo is being guarded by two sets of early-exits, one in foo and one
// in bar, and therefore we only really need one; if foo did anything
// more than just call bar, that would be incorrect.
//
// We must be careful of loops, however: If A calls B and B calls A,
// then at least one must keep the early-exit logic, or else they
Expand Down

0 comments on commit c82627e

Please sign in to comment.