[hail] Simplify nested struct inserts broken by lets#7096
Merged
danking merged 3 commits intohail-is:masterfrom Sep 20, 2019
Merged
[hail] Simplify nested struct inserts broken by lets#7096danking merged 3 commits intohail-is:masterfrom
danking merged 3 commits intohail-is:masterfrom
Conversation
patrick-schultz
requested changes
Sep 20, 2019
| case _ => true | ||
| } | ||
| case Let(name, value, body) if { | ||
| @tailrec def getNestedInsertFields(x: IR): Option[InsertFields] = x match { |
Member
There was a problem hiding this comment.
Ultimately, I think the right way to handle optimization rules being obscured by lets (and other things like ifs) is with commuting conversions. In this case, the commuting conversion is Let("a", Let("b", B, A), body) -> Let("b", B, Let("a", A, body)). After all instances of that rule have run, the value of a let never contains a top-level let.
Do you think that would have any negative consequences in the current system? I'm a little concerned about how complex some of these simplify rules are getting.
Contributor
Author
There was a problem hiding this comment.
oh, this does seem better. I'll give that a shot.
Contributor
Author
There was a problem hiding this comment.
great suggestion! Takes the simplify.scala change down to one line :)
patrick-schultz
approved these changes
Sep 20, 2019
28e3a82 to
faa0d85
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on the last PR, that didn't actually solve the general problem. See the test at the bottom for an example of an IR that wasn't matching the rule.