File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -526,7 +526,13 @@ struct OnceReduction : public Pass {
526
526
// the global and call bar, and in AFTER we also call bar.
527
527
//
528
528
// Thus, the behavior is the same, and we can remove the early-exit
529
- // lines.
529
+ // lines. Note that things would be quite different if we had any code
530
+ // after the call to bar(), as then that code would no longer be
531
+ // guarded by an early-exit (and could end up called more than once).
532
+ // That is, this optimization depends on the fact that bar's call from
533
+ // foo is being guarded by two sets of early-exits, one in foo and one
534
+ // in bar, and therefore we only really need one; if foo did anything
535
+ // more than just call bar, that would be incorrect.
530
536
//
531
537
// We must be careful of loops, however: If A calls B and B calls A,
532
538
// then at least one must keep the early-exit logic, or else they
You can’t perform that action at this time.
0 commit comments