Skip to content

Stop needing materialized places for most intrinsics#156116

Open
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:tweak-layout-of-alternative
Open

Stop needing materialized places for most intrinsics#156116
scottmcm wants to merge 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
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 22, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Copy link
Copy Markdown
Member

@dianqk dianqk left a comment

Choose a reason for hiding this comment

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

@dianqk
Copy link
Copy Markdown
Member

dianqk commented May 22, 2026

r=me after CI greens.

@scottmcm
Copy link
Copy Markdown
Member Author

@bors r=dianqk

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 22, 2026

📌 Commit c4f62d6 has been approved by dianqk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 May 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 22, 2026
Stop needing materialized places for most intrinsics



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
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot 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 May 22, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 22, 2026

💔 Test for 0ce41cf failed: CI. Failed job:

@scottmcm scottmcm force-pushed the tweak-layout-of-alternative branch from c4f62d6 to d3d3485 Compare May 23, 2026 05:02
@rust-bors rust-bors Bot 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-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2026
@scottmcm
Copy link
Copy Markdown
Member Author

@bors try jobs=x86_64-gnu-debug

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 23, 2026
Stop needing materialized places for most intrinsics


try-job: x86_64-gnu-debug
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

☀️ Try build successful (CI)
Build commit: 6d1a0f5 (6d1a0f55bfb34db3817bb0a2c82f7eeca9fbc013, parent: 54333ff079780f803f65dcee30c544050b35f544)

@dianqk
Copy link
Copy Markdown
Member

dianqk commented May 23, 2026

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

📌 Commit d3d3485 has been approved by dianqk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 May 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 23, 2026
Stop needing materialized places for most intrinsics



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
@rust-bors rust-bors Bot 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 May 23, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 23, 2026

💔 Test for 6010ec0 failed: CI. Failed job:

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. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants