-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-converging optimizer pass for used functions.
The optimizer's `FunctionVisitor` computes whether a function is used or required by any feature. Since recently we now hold all modules in a single AST. This means that we need at least one full pass through the AST to collect feature constants so we can decided whether a function is required by a feature and cannot be elided. The initial implementation of this used explicit control flow, but this is error-prone like seen in This patch removes the explicit control flow and instead checks whether we have discovered any new feature constants. With that the optimizer pass converges again. Closes #1808.
- Loading branch information
Showing
2 changed files
with
27 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @TEST-DOC: Regression test for #1808. | ||
# We expect this call to terminate. | ||
# @TEST-EXEC: spicyc -dj %INPUT | ||
|
||
module test; | ||
|
||
type X = unit { | ||
# Field with name identical to type name below. | ||
foo: uint8; | ||
}; | ||
|
||
type foo = unit {}; |