-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug[next]: Respect evaluation order in
InlineCenterDerefLiftVars
(#…
…1883) Changes the `InlineCenterDerefLiftVars` pass to respect evaluation order by lazily evaluating the inlined values. Consider the following case that is common in boundary conditions: ``` let(var, (↑deref)(it2))(if ·on_bc then 0 else ·var) ``` Then var should only be dereferenced in case `·on_bc` evalutes to False. Previously we just evaluated all values unconditionally: ``` let(_icdlv_1, ·it)(if ·on_bc then 0 else _icdlv_1) ``` Now we instead create a 0-ary lambda function for `_icdlv_1` and evaluate it when the value is needed. ``` let(_icdlv_1, λ() → ·it)(if ·on_bc then 0 else _icdlv_1()) ``` Note that as a result we do evaluate the function multiple times. To avoid redundant recompuations usage of the common subexpression elimination is required.
- Loading branch information
1 parent
847d8ab
commit 587d107
Showing
3 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters