-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Mark inactive enum variants along "otherwise" edge as uninitialized #77377
Mark inactive enum variants along "otherwise" edge as uninitialized #77377
Conversation
@bors try |
Awaiting bors try build completion |
⌛ Trying commit e0438129233fbe7e1724b05c52f46bd2f2b89730 with merge d23533d70fe2773aabe056564e0930e7e72b70be... |
☀️ Try build successful - checks-actions, checks-azure |
Queued d23533d70fe2773aabe056564e0930e7e72b70be with parent 867bd42, future comparison URL. |
Finished benchmarking try commit (d23533d70fe2773aabe056564e0930e7e72b70be): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
This means all enum variants whose discriminant has a dedicated outgoing edge in the `SwitchInt` terminator.
e043812
to
fac0ad6
Compare
Thanks to cuviper, we've learned that this class of optimizations is not the root cause of #77382. In a Bayesian sense, I'm now more confident that #74551 is similarly unrelated, although I still don't have the hardware to verify that hypothesis. Given the new data, I'm comfortable getting this on nightly and riding the trains to stable. Most users (including people building |
☔ The latest upstream changes (presumably #77466) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
@pnkfelix any updates on the review? |
} else { | ||
// We're on the otherwise branch. All variants that we visited above are known to be | ||
// uninitialized. | ||
for &variant_mpi in &variant_mpis_with_edge { |
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.
Is there a guarantee that the otherwise branch is always invoked last during the iteration performed by edge_effects.apply
?
Because, as best as I can tell, it seems like you are relying here on such a guarantee (since you are accumulating all the values in variant_mpis_with_edge
during the callback invocations on the non-otherwise edges.
But skimming over the doc comments added in PR #77242, I do not see any such guarantee in the documentation for apply_switch_int_edge_effects
.
(And overall, I think the logic here would be easier to understand if the block structure in the code reflected that ordering constraint, even if it requires changes to the dataflow API. I don't know the best way to express it; perhaps by two distinct callbacks instead of just one, where the first callback is invoked for all the edge.value.is_some()
cases here, and the second callback for the otherwise case?)
This is a really cool idea. I will admit I am concerned about whether the code is relying on undocumented guarantees, as noted in a comment on the diff itself. But that's the main piece of feedback I have at the moment. |
@ecstatic-morse any updates? |
Closing this as inactive |
This is a slight improvement on #68528 and #73879. Previously, the interface to the dataflow framework did not allow edge-specific effects along the "otherwise" edge of a
SwitchInt
terminator. #77242 fixed this. Now we can mark enum variants whose discriminant is handled in an integer-valuedSwitchInt
edge as definitely uninitialized along the "otherwise" edge. Notably, this applies within anelse
block attached to anif let
expression.