-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add eta reduction miniphase #14210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add eta reduction miniphase #14210
Conversation
Fixes scala#10889. Alternative to scala#13750, from which the test is taken.
That was a quickie. Shorter test with arbitrary constants
|
@@ -106,6 +106,7 @@ class Compiler { | |||
List(new ElimErasedValueType, // Expand erased value types to their underlying implmementation types | |||
new PureStats, // Remove pure stats from blocks | |||
new VCElideAllocations, // Peep-hole optimization to eliminate unnecessary value class allocations | |||
new EtaReduce, // Reduce eta expansions of pure paths to the underlying function reference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any fundamental reason this is after erasure but the existing BetaReduce phase is before erasure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment of betaReduce mentions blackbox macros, which would be eliminated after erasure. That might have something to do with it, but I did not dig deeper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EtaReduce is after erasure since a lot of context function wizardry happens before or at erasure so we want to make sure this is all done before we apply the optimization.
This is great, thanks! |
Fixes #10889. Alternative to #13750, from which the test is taken.