Skip to content
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

Pass correct place to discriminant_switch_effect #69676

Merged
merged 1 commit into from
Mar 7, 2020

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Mar 3, 2020

PR #69562, which fixed a bug that was causing clippy to ICE, mistakenly passed the place holding the result of Rvalue::Discriminant instead of the place holding its operand to apply_discriminant_switch_effect as the enum place. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized.

edit: The regression test has been split into #69744.

r? @oli-obk

PR rust-lang#69562, which fixed a bug that was causing clippy to ICE, passed the
place for the *result* of `Rvalue::Discriminant` instead of the
*operand* to `apply_discriminant_switch_effect`. As a result, no effect
was applied at all, and we lost the perf benefits from marking
inactive enum variants as uninitialized.
@oli-obk
Copy link
Contributor

oli-obk commented Mar 3, 2020

🤦‍♀️ that's subtle. I want to overhaul mir opt tests anyway. Then it may be easier to write such tests

@bors r+

@bors
Copy link
Contributor

bors commented Mar 3, 2020

📌 Commit 8d325e6 has been approved by oli-obk

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 3, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 4, 2020
…t, r=oli-obk

Pass correct place to `discriminant_switch_effect`

PR rust-lang#69562, which fixed a bug that was causing clippy to ICE, mistakenly passed the place holding the *result* of `Rvalue::Discriminant` instead of the place holding its *operand* to `apply_discriminant_switch_effect` as the enum place. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized.

This PR corrects that mistake and adds a regression test to `mir-opt`. I fear that the regression test may prove too brittle; the test schema makes hard to test for the *absence* of certain kinds of MIR without exhaustively matching each basic block.

r? @oli-obk
@JohnTitor
Copy link
Member

Failed in #69720 (comment)
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 5, 2020
@ecstatic-morse
Copy link
Contributor Author

The Linux test-various runner failed since it produced MIR with no cleanup blocks. It looks like some other mir-opt tests use ignore-wasm32-bare, so I've added it to the new test. However, I'm not sure this will fix the issue, since I would have expected the test-wasm32 runner to fail, not test-various.

Any advice @oli-obk? I want to get this merged before beta branches, so maybe we could split the test into a second PR?

@oli-obk
Copy link
Contributor

oli-obk commented Mar 5, 2020

Yea, split the test into a separate PR. r=me on both this PR and the test PR

@ecstatic-morse
Copy link
Contributor Author

Regression test has been split into #69744.

@bors r=oli-obk rollup=never
(for perf)

@bors
Copy link
Contributor

bors commented Mar 5, 2020

📌 Commit e82ec23 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 5, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 6, 2020
…t, r=oli-obk

Pass correct place to `discriminant_switch_effect`

PR rust-lang#69562, which fixed a bug that was causing clippy to ICE, mistakenly passed the place holding the *result* of `Rvalue::Discriminant` instead of the place holding its *operand* to `apply_discriminant_switch_effect` as the enum place. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized.

**edit:** The regression test has been split into rust-lang#69744.

r? @oli-obk
bors added a commit that referenced this pull request Mar 6, 2020
Rollup of 6 pull requests

Successful merges:

 - #69656 (Use .next() instead of .nth(0) on iterators.)
 - #69674 (Rename DefKind::Method and TraitItemKind::Method )
 - #69676 (Pass correct place to `discriminant_switch_effect`)
 - #69706 (Use subslice patterns in slice methods)
 - #69714 (Make PlaceRef take just one lifetime)
 - #69727 (Avoid using `unwrap()` in suggestions)

Failed merges:

 - #69589 (ast: `Mac`/`Macro` -> `MacCall`)
 - #69680 (rustc_expand: Factor out `Annotatable::into_tokens` to a separate method)

r? @ghost
@oli-obk
Copy link
Contributor

oli-obk commented Mar 6, 2020

@bors p=1

@bors
Copy link
Contributor

bors commented Mar 6, 2020

⌛ Testing commit e82ec23 with merge 9e12600c78511f2a6266acf2b68047a5e36ef395...

@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Mar 6, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 6, 2020
@pietroalbini
Copy link
Member

@bors treeclosed=1000 retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2020
@pietroalbini
Copy link
Member

@bors p=1001

@bors
Copy link
Contributor

bors commented Mar 7, 2020

⌛ Testing commit e82ec23 with merge 823ff8c...

@bors
Copy link
Contributor

bors commented Mar 7, 2020

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing 823ff8c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 7, 2020
@bors bors merged commit 823ff8c into rust-lang:master Mar 7, 2020
@jonas-schievink
Copy link
Contributor

@bors treeclosed-

bors added a commit that referenced this pull request Mar 14, 2020
…li-obk

Add `mir-opt` test for more precise drop elaboration

Depends on #69676. This test should ensure that the problem fixed in that PR does not reoccur.

This has been split out from #69676 since the test fails on certain targets where no cleanup blocks are emitted. I have to find the correct `ignore` directives.

r? @oli-obk
@ecstatic-morse ecstatic-morse deleted the fix-enum-discr-effect branch October 6, 2020 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants