-
Notifications
You must be signed in to change notification settings - Fork 195
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
[hlsl-out] clear named_expressions
inserted by duplicated blocks
#2116
Conversation
238caac
to
93a7340
Compare
Another way of doing this (which avoids the recursion) would be to use I'll push a commit that does this (which I can revert if we don't want to go this route). |
Seems like we need indexmap-rs/indexmap#215 for that to work... |
I'll revert the last commit, adding |
I'm not sure why you think so... indexmap-rs/indexmap#246 |
@cuviper a PR, that's great! I was looking into deriving it (which would have required RawTable in hashbrown to also impl the trait). |
@cuviper do you have an ETA on that PR landing and possibly a new release? |
Ah, deriving the fields directly would be unlikely to produce a coherent map. I just followed how each I went ahead and merged that on |
If it's not too much trouble, it would be greatly appreciated :) |
Done -- |
04ccbab
to
9522e2a
Compare
@jimblandy: Were you still going to review this for another round? I'm thinking of trying to tackle this. |
Now that I actually understand what it's doing (from reviewing the switch PR), I was going to look it over again. Although, I'm pretty buried in #2075 right now. |
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.
LGTM! Some non-blocking meta nits:
- I sorta wish the justification for
indexmap
would land in the message of the commit introducing it, rather than just being GH discussion. That would make it easier for folks examining history.git commit --fixup=amend…
is your friend! - It's sorta odd to introduce a solution to the problem then immediately replace it in the same PR, but I don't see any issue with it.
tests/out/hlsl/control-flow.hlsl
Outdated
switch(0) { | ||
case 2: { | ||
{ | ||
} | ||
{ | ||
int i_1 = int(1); | ||
} | ||
break; | ||
} | ||
default: { | ||
int i_2 = int(1); | ||
break; |
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.
thought: It's interesting that the hlsl
backend doesn't eliminate the dead code in this test case.
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.
Yeah, we don't have any optimization passes. All the compilers naga targets have their own already.
Thanks for the review!
I left all commits in for now because I wanted some feedback on both approaches and was planning to squash everything when rebasing (before merging).
Will do. |
9522e2a
to
a75312c
Compare
Squashed and rebased. I had to remove the test since we removed support for fallthrough for the wgsl frontend in #2031. |
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.
Still LGTM!
changed the type of `named_expressions` from `HashMap` to `IndexMap` so that insertion order is preserved
a75312c
to
8fe0970
Compare
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.
This looks great - much simpler than the original fix. It's a pity we can't test this.
fixes #1972