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

Check whether locals are too large instead of whether accesses into them are too large #74821

Merged
merged 7 commits into from
Aug 7, 2020

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 27, 2020

Essentially this stops const prop from attempting to optimize

let mut x = [0_u8; 5000];
x[42] = 3;

I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2020
@oli-obk

This comment has been minimized.

@rust-timer

This comment has been minimized.

@bors

This comment has been minimized.

@oli-obk oli-obk force-pushed the const_eval_read_uninit_fast_path branch from b94da2b to 74ff07e Compare July 27, 2020 12:27
@oli-obk oli-obk changed the title Check wether locals are too large instead of whether accesses into them are too large Check whether locals are too large instead of whether accesses into them are too large Jul 27, 2020
@oli-obk oli-obk force-pushed the const_eval_read_uninit_fast_path branch from 74ff07e to a9725ee Compare July 27, 2020 13:02
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 27, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Jul 27, 2020

⌛ Trying commit a9725ee777812a379d62de197d7c1bbed4cf45eb with merge bd190279c18106147d12a444e6ae7bc861b2de24...

@bors
Copy link
Contributor

bors commented Jul 27, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: bd190279c18106147d12a444e6ae7bc861b2de24 (bd190279c18106147d12a444e6ae7bc861b2de24)

@rust-timer
Copy link
Collaborator

Queued bd190279c18106147d12a444e6ae7bc861b2de24 with parent 52d2c7a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (bd190279c18106147d12a444e6ae7bc861b2de24): 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 rollup- to bors.

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

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Can we add a mir-opt test showing that

let mut x = [0_u8; 5000];
x[42] = 3;

does not propagate? r=me with a test.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 28, 2020

@bors r=wesleywiser

@bors
Copy link
Contributor

bors commented Jul 28, 2020

📌 Commit 590885ade8a4363e1a7a75a0ffeed98236df8aa5 has been approved by wesleywiser

@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 Jul 28, 2020
@bors
Copy link
Contributor

bors commented Jul 28, 2020

⌛ Testing commit 590885ade8a4363e1a7a75a0ffeed98236df8aa5 with merge c0c2bd7f44ee27f17f8fbff023d61267636fa763...

@bors
Copy link
Contributor

bors commented Jul 28, 2020

💔 Test failed - checks-actions

@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 Jul 28, 2020
@oli-obk oli-obk force-pushed the const_eval_read_uninit_fast_path branch from 590885a to 99a85e8 Compare July 28, 2020 14:51
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 28, 2020

@bors r=wesleywiser

@bors
Copy link
Contributor

bors commented Jul 28, 2020

📌 Commit 99a85e811f45b7aa02d917c44c12702d007b9131 has been approved by wesleywiser

@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 Jul 29, 2020
@bors
Copy link
Contributor

bors commented Jul 29, 2020

☔ The latest upstream changes (presumably #74837) made this pull request unmergeable. Please resolve the merge conflicts.

@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 Jul 29, 2020
We used to erase these values immediately after propagation, but some
things slipped through and it caused us to still initialize huge locals.
The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.
@oli-obk oli-obk force-pushed the const_eval_read_uninit_fast_path branch from 303547c to 1864a97 Compare July 29, 2020 20:40
@oli-obk oli-obk added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 29, 2020
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 29, 2020

I made some changes to the mir-opt test suite. It now prints the name of the mir dump file it's expecting and the path to the file which requested the mir dump

let to_full_path = |path: PathBuf| {
let full = self.get_mir_dump_dir().join(&path);
if !full.exists() {
panic!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 there are a couple other places in check_mir_dump that also produce confusing / less useful errors but that could be fixed in a seperate pr.

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 7, 2020

📌 Commit 1864a97 has been approved by wesleywiser

@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 Aug 7, 2020
@bors
Copy link
Contributor

bors commented Aug 7, 2020

⌛ Testing commit 1864a97 with merge 4d43423...

@bors
Copy link
Contributor

bors commented Aug 7, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: wesleywiser
Pushing 4d43423 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 7, 2020
@bors bors merged commit 4d43423 into rust-lang:master Aug 7, 2020
@oli-obk oli-obk deleted the const_eval_read_uninit_fast_path branch August 8, 2020 08:35
flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 11, 2020
…ath, r=wesleywiser

Check whether locals are too large instead of whether accesses into them are too large

Essentially this stops const prop from attempting to optimize

```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```

I don't expect this to be a perf improvement without rust-lang#73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
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.

7 participants