Replace discriminant_switch_effect with more general version #77242
Replace discriminant_switch_effect with more general version #77242bors merged 4 commits intorust-lang:masterfrom
discriminant_switch_effect with more general version #77242Conversation
|
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
6695e85 to
d83e406
Compare
...that allows arbitrary effects on each edge of a `SwitchInt` terminator.
d83e406 to
e65421d
Compare
e65421d to
2364b58
Compare
|
This shouldn't really affect perf, although it does do slightly less work than the old version. Just in case. @bors try |
|
Awaiting bors try build completion |
|
⌛ Trying commit 2364b58 with merge b61b01669af3db2429eae891e9c9da925db8d359... |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
💔 Test failed - checks-actions |
|
@jyn514 AFAIK, we always pass |
|
@bors try |
|
⌛ Trying commit c0cd1b0 with merge 3191331f311bf46f945abd05d1e078654803bdc7... |
|
Splitting this into a separate lint sounds useful, I'll work on that. In the meantime you can add |
|
☀️ Try build successful - checks-actions, checks-azure |
|
Queued 3191331f311bf46f945abd05d1e078654803bdc7 with parent 623fb90, future comparison URL. |
|
I don't know enough about this. r? @jonas-schievink maybe |
|
Finished benchmarking try commit (3191331f311bf46f945abd05d1e078654803bdc7): 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 |
|
@bors r+ |
|
📌 Commit c0cd1b0 has been approved by |
|
☀️ Test successful - checks-actions, checks-azure |
#68528 added a new edge-specific effect for
SwitchIntterminators,discriminant_switch_effect, to the dataflow framework. While this accomplished the short-term goal of making drop elaboration more precise, it wasn't really useful in other contexts: It only supportedSwitchInts on the discriminant of anenumand did not allow effects to be applied along the "otherwise" branch. In const-propagation, for example, arbitrary edge-specific effects for the targets of aSwitchIntcan be used to remember the value amatchscrutinee must have in each arm.This PR replaces
discriminant_switch_effectwith a more generalswitch_int_edge_effectsmethod. The new method has a slightly different interface from the other edge-specific effect methods (e.g.call_return_effect). This divergence is explained in the new method's documentation, and reading the changes to the various dataflow impls as well asdirection.rsshould further clarify things. This PR should not change behavior.