Skip to content

Stop needing materialized places for most intrinsics#156116

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
scottmcm:tweak-layout-of-alternative
May 23, 2026
Merged

Stop needing materialized places for most intrinsics#156116
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
scottmcm:tweak-layout-of-alternative

Conversation

@scottmcm
Copy link
Copy Markdown
Member

@scottmcm scottmcm commented May 3, 2026

View all comments

Today even to return a constant from size_of_val it takes an alloca. That's wasteful.

This updates the cg_ssa traits to allow returning an OperandValue instead, which is possible for the vast majority of intrinsics -- this PR moves all but 5 over to doing that in LLVM.

The first commit adds a test to help show the difference here.

cc rust-lang/compiler-team#970 #153250

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 3, 2026
@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from 0bc61de to a8a0062 Compare May 3, 2026 19:13
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from a8a0062 to 7a7f99b Compare May 3, 2026 19:23
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from 7a7f99b to 1f0a500 Compare May 3, 2026 19:51
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from 1f0a500 to 6eb4607 Compare May 3, 2026 19:59
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from 6eb4607 to e19fd5d Compare May 3, 2026 23:57
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from e19fd5d to 2f79728 Compare May 4, 2026 01:04
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from 2f79728 to 10f00b6 Compare May 4, 2026 02:10
@scottmcm
Copy link
Copy Markdown
Member Author

scottmcm commented May 4, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 4, 2026
Stop needing materialized places for most intrinsics
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

☀️ Try build successful (CI)
Build commit: ce9f4cc (ce9f4cc0887ef1020c405689861eeb71f9095196, parent: 045b17737dab5fcc28e4cbee0cfe2ce4ed363b32)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ce9f4cc): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.2%] 2
All ❌✅ (primary) -0.1% [-0.1%, -0.1%] 1

Max RSS (memory usage)

Results (secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [0.5%, 7.5%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-6.3%, -0.6%] 4
All ❌✅ (primary) - - 0

Cycles

Results (secondary -1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.7% [0.6%, 0.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-5.7%, -0.4%] 5
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.1%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 18
Improvements ✅
(secondary)
-0.1% [-0.2%, -0.0%] 25
All ❌✅ (primary) -0.1% [-0.2%, -0.1%] 18

Bootstrap: 496.439s -> 493.878s (-0.52%)
Artifact size: 394.45 MiB -> 394.37 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 4, 2026
@scottmcm
Copy link
Copy Markdown
Member Author

scottmcm commented May 4, 2026

r? codegen

@scottmcm scottmcm marked this pull request as ready for review May 4, 2026 06:29
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 4, 2026

The GCC codegen subtree was changed

cc @antoyo, @GuillaumeGomez

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2026
@jieyouxu
Copy link
Copy Markdown
Member

@bors try

@rust-bors

This comment has been minimized.

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

💔 Test for b1f66da failed: CI. Failed job:

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

☀️ Try build successful (CI)
Build commit: 5ac611a (5ac611a3adbef2eb5b7e1cd27c4d415a9f695d4a, parent: 54333ff079780f803f65dcee30c544050b35f544)

@jieyouxu
Copy link
Copy Markdown
Member

@bors retry

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

💔 Test for e937495 failed: CI. Failed jobs:

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@jieyouxu
Copy link
Copy Markdown
Member

@bors retry

@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

💔 Test for 04861ff failed: CI. Failed job:

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@jieyouxu
Copy link
Copy Markdown
Member

@bors retry

@rust-bors

This comment has been minimized.

@jieyouxu
Copy link
Copy Markdown
Member

@bors treeclosed-

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

Tree is now open for merging.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

☀️ Test successful - CI
Approved by: dianqk
Duration: 3h 10m 17s
Pushing 23a3312 to main...

@github-actions
Copy link
Copy Markdown
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 54333ff (parent) -> 23a3312 (this PR)

Test differences

Show 6 test diffs

Stage 1

  • [codegen] tests/codegen-llvm/intrinsics/size_and_align_of_val.rs: [missing] -> pass (J0)
  • [codegen] tests/codegen-llvm/intrinsics/size_and_align_of_val.rs: [missing] -> ignore (only executed when the pointer width is 64bit ((so I don't need to worry about usize))) (J3)

Stage 2

  • [codegen] tests/codegen-llvm/intrinsics/size_and_align_of_val.rs: [missing] -> ignore (only executed when the pointer width is 64bit ((so I don't need to worry about usize))) (J1)
  • [codegen] tests/codegen-llvm/intrinsics/size_and_align_of_val.rs: [missing] -> pass (J2)

Additionally, 2 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 23a3312d92a1c4ba0373f1e25277be20ba8bb28c --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. optional-x86_64-gnu-parallel-frontend: 1h 34m -> 2h 42m (+72.6%)
  2. x86_64-msvc-2: 1h 36m -> 2h 27m (+53.2%)
  3. dist-sparcv9-solaris: 1h 6m -> 1h 33m (+40.3%)
  4. x86_64-gnu-llvm-22-2: 1h 41m -> 1h (-39.7%)
  5. pr-check-1: 26m 24s -> 34m 40s (+31.3%)
  6. x86_64-mingw-2: 2h 45m -> 2h (-27.5%)
  7. x86_64-msvc-ext2: 2h -> 1h 30m (-25.4%)
  8. x86_64-gnu-llvm-22-3: 1h 51m -> 1h 30m (-19.2%)
  9. dist-x86_64-freebsd: 1h 24m -> 1h 8m (-18.6%)
  10. x86_64-gnu-tools: 56m 58s -> 1h 7m (+18.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (23a3312): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.7%, -0.7%] 1
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 3
All ❌✅ (primary) -0.7% [-0.7%, -0.7%] 1

Max RSS (memory usage)

Results (primary -2.7%, secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.2% [3.2%, 3.2%] 1
Regressions ❌
(secondary)
2.0% [1.4%, 2.4%] 3
Improvements ✅
(primary)
-5.7% [-9.3%, -2.2%] 2
Improvements ✅
(secondary)
-5.9% [-6.4%, -5.5%] 3
All ❌✅ (primary) -2.7% [-9.3%, 3.2%] 3

Cycles

Results (primary -0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-3.4%, 2.4%] 2

Binary size

Results (primary -0.0%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 4
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 23
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 21
All ❌✅ (primary) -0.0% [-0.1%, 0.0%] 27

Bootstrap: 510.282s -> 511.109s (0.16%)
Artifact size: 400.55 MiB -> 400.56 MiB (0.00%)

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  COMMIT_MESSAGE: cargo update 
##[endgroup]
Downloading single artifact
Preparing to download the following artifacts:
- Cargo-lock (ID: 7180987921, Size: 51244, Expected Digest: sha256:287c6c4c582b1d7ee438c2c72791c4684aa7765e12b02616636c2cedde6e5eb5)
Redirecting to blob download url: https://productionresultssa7.blob.core.windows.net/actions-results/1b05cc50-0d3f-44a8-85b7-52b40b9162ce/workflow-job-run-d00685c7-c578-50ec-9c55-5399185aed8b/artifacts/858175980ba8726bab9f963fd06060d5199d874bbd735e523e2d990d354f8c0b.zip
Starting download of artifact to: /home/runner/work/rust/rust
(node:2318) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
SHA256 digest of downloaded artifact is 287c6c4c582b1d7ee438c2c72791c4684aa7765e12b02616636c2cedde6e5eb5
Artifact download completed successfully.
Total of 1 artifact(s) downloaded
Download artifact has finished successfully
---
  COMMIT_MESSAGE: cargo update 
##[endgroup]
Downloading single artifact
Preparing to download the following artifacts:
- cargo-updates (ID: 7180988006, Size: 2932, Expected Digest: sha256:f53eab58bd204bdd3e56d7689eb81d65a6dbfa7d1a3550b36c3ab6e2d354c107)
Redirecting to blob download url: https://productionresultssa7.blob.core.windows.net/actions-results/1b05cc50-0d3f-44a8-85b7-52b40b9162ce/workflow-job-run-d00685c7-c578-50ec-9c55-5399185aed8b/artifacts/ce9034d4568b3430f906da1368ae1cf3e14ef1542859eb2e8d635c0876371f53.zip
Starting download of artifact to: /home/runner/work/rust/rust
(node:2329) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
SHA256 digest of downloaded artifact is f53eab58bd204bdd3e56d7689eb81d65a6dbfa7d1a3550b36c3ab6e2d354c107
Artifact download completed successfully.
Total of 1 artifact(s) downloaded
Download artifact has finished successfully
##[group]Run echo "${COMMIT_MESSAGE}" > commit.txt
echo "${COMMIT_MESSAGE}" > commit.txt
cat cargo_update.log >> commit.txt

echo "${PR_MESSAGE}" > body.md
echo '```txt' >> body.md
cat cargo_update.log >> body.md
echo '```' >> body.md
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
dep-bumps
following is the output from `cargo update`:
  COMMIT_MESSAGE: cargo update 
##[endgroup]
##[group]Run git config user.name github-actions
git config user.name github-actions
git config user.email github-actions@github.com
git switch --force-create cargo_update
git add ./Cargo.lock ./library/Cargo.lock ./src/tools/rustbook/Cargo.lock
git commit --no-verify --file=commit.txt
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
dep-bumps
following is the output from `cargo update`:
  COMMIT_MESSAGE: cargo update 
##[endgroup]
remote: error: GH013: Repository rule violations found for refs/heads/cargo_update.        
remote: Review all repository rules at https://github.com/rust-lang/rust/rules?ref=refs%2Fheads%2Fcargo_update        
remote: 
remote: - Cannot update this protected ref.        
remote: 
remote: - Changes must be made through a pull request.        
remote: 
remote: - Cannot force-push to this branch        
remote: 
To https://github.com/rust-lang/rust
 ! [remote rejected]   cargo_update -> cargo_update (push declined due to repository rule violations)
error: failed to push some refs to 'https://github.com/rust-lang/rust'
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. 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.

7 participants