Skip to content

rustc_codegen_ssa: use project_index, not project_field, for array literals. #98675

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

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Jun 29, 2022

See #98615 (comment) for some context.

In short, we were using project_field even for array mir::Rvalue::Aggregates, which results in benchmarks like deep-vector.rs (and presumably also some real-world usecases?) being impacted by how we handle non-array aggregate fields.

(This is a separate PR so that we can measure the perf effects in isolation)

r? @nikic

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 29, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2022
@eddyb
Copy link
Member Author

eddyb commented Jun 29, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 29, 2022
@bors
Copy link
Collaborator

bors commented Jun 29, 2022

⌛ Trying commit 900309e with merge 3c75882df207e888735b29c93586041759b61c67...

@bors
Copy link
Collaborator

bors commented Jun 29, 2022

☀️ Try build successful - checks-actions
Build commit: 3c75882df207e888735b29c93586041759b61c67 (3c75882df207e888735b29c93586041759b61c67)

@rust-timer
Copy link
Collaborator

Queued 3c75882df207e888735b29c93586041759b61c67 with parent 66c83ff, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3c75882df207e888735b29c93586041759b61c67): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.4% -2.9% 4
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
2.8% 2.8% 1
Regressions 😿
(secondary)
2.2% 2.2% 1
Improvements 🎉
(primary)
-4.1% -4.1% 1
Improvements 🎉
(secondary)
-2.3% -2.3% 1
All 😿🎉 (primary) -0.6% -4.1% 2

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.3% -2.5% 4
All 😿🎉 (primary) N/A N/A 0

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 29, 2022
@eddyb
Copy link
Member Author

eddyb commented Jun 30, 2022

cc @rust-lang/wg-llvm I don't know how well "struct GEP" on arrays works, or if other frontends even emit it, but it looks like moving from that to a normal array-oriented GEP is an improvement.

(And presumably even with opaque pointers we would always want to craft LLVM GEPs for array accesses such that they express a "stride" and an "index" instead of just being a raw offset, even if that "stride" isn't necessarily a typed array element - at least as long as LLVM cares about any of these things)

@nikic
Copy link
Contributor

nikic commented Jul 7, 2022

Sounds reasonable to me.

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 7, 2022

📌 Commit 900309e has been approved by nikic

@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 7, 2022
@bors
Copy link
Collaborator

bors commented Jul 7, 2022

⌛ Testing commit 900309e with merge 20dd693...

@bors
Copy link
Collaborator

bors commented Jul 7, 2022

☀️ Test successful - checks-actions
Approved by: nikic
Pushing 20dd693 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 7, 2022
@bors bors merged commit 20dd693 into rust-lang:master Jul 7, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 7, 2022
@eddyb eddyb deleted the cg-array-literal branch July 7, 2022 15:26
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (20dd693): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-2.2% -2.4% 4
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
0.8% 1.5% 2
Regressions 😿
(secondary)
2.0% 2.0% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.8% 1.5% 2

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
2.9% 2.9% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-2.4% -2.4% 1
Improvements 🎉
(secondary)
-2.2% -2.4% 2
All 😿🎉 (primary) 0.3% 2.9% 2

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants