Skip to content

Conversation

sayantn
Copy link
Contributor

@sayantn sayantn commented Jun 14, 2025

Follow-up to #142259

This also needs a rustc-perf run, because Intrinsic::getType can be expensive

@rustbot label A-LLVM A-codegen T-compiler
r? @workingjubilee
cc @nikic

@rustbot rustbot added 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. A-codegen Area: Code generation labels Jun 14, 2025
@workingjubilee
Copy link
Member

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jun 14, 2025
Use `LLVMIntrinsicGetDeclaration` to completely remove the hardcoded intrinsics list

Follow-up to #142259

This also needs a rustc-perf run, because `Intrinsic::getType` can be expensive

`@rustbot` label A-LLVM A-codegen T-compiler
r? `@workingjubilee`
cc `@nikic`
@rust-bors
Copy link

rust-bors bot commented Jun 14, 2025

⌛ Trying commit 10a73c9 with merge 5e963b3

To cancel the try build, run the command @bors2 try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 14, 2025
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member

hum.

@rust-bors
Copy link

rust-bors bot commented Jun 14, 2025

💔 Test failed

@sayantn
Copy link
Contributor Author

sayantn commented Jun 14, 2025

interesting segfault, I have a suspicion that this is due to get_type_of_global. Let me try without that

@sayantn sayantn force-pushed the simplify-intrinsics branch from 10a73c9 to 7504607 Compare June 15, 2025 00:00
@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

ah, so it was due to a mistake in the last PR, it didn't have any type parameters for llvm.threadlocal.address, where it should have 1 (surprisingly LLVMCopyOverloadedName2 didn't complain about this)

@workingjubilee
Copy link
Member

Oh, distressing.

@workingjubilee
Copy link
Member

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 15, 2025

⌛ Trying commit 7504607 with merge 904f591

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 15, 2025
Use `LLVMIntrinsicGetDeclaration` to completely remove the hardcoded intrinsics list

Follow-up to #142259

This also needs a rustc-perf run, because `Intrinsic::getType` can be expensive

`@rustbot` label A-LLVM A-codegen T-compiler
r? `@workingjubilee`
cc `@nikic`
bors added a commit that referenced this pull request Jun 15, 2025
Use `LLVMIntrinsicGetDeclaration` to completely remove the hardcoded intrinsics list

Follow-up to #142259

This also needs a rustc-perf run, because `Intrinsic::getType` can be expensive

`@rustbot` label A-LLVM A-codegen T-compiler
r? `@workingjubilee`
cc `@nikic`
@bors
Copy link
Collaborator

bors commented Jun 15, 2025

⌛ Trying commit 7504607 with merge f92eca7...

@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

is bors ghosting us now?

@workingjubilee
Copy link
Member

oh no, the latency.

@workingjubilee
Copy link
Member

@bors2 try cancel

@rust-bors
Copy link

rust-bors bot commented Jun 15, 2025

Try build cancelled. Cancelled workflows:

@workingjubilee
Copy link
Member

AHA, MY PLAN WAS TO TEST THE CANCEL FUNCTION ALL ALONG

@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

that is some serious difference in latency.

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

☀️ Try build successful - checks-actions
Build commit: f92eca7 (f92eca7e3359f7ee0ba466a9b35495d947e2d602)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f92eca7): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) -1.4% [-1.4%, -1.4%] 1

Max RSS (memory usage)

Results (secondary 0.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)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 758.463s -> 757.066s (-0.18%)
Artifact size: 372.25 MiB -> 372.23 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2025
@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

Yay! No perf regression ❤️

@@ -138,7 +138,7 @@ pub(crate) struct FullCx<'ll, 'tcx> {
pub rust_try_fn: Cell<Option<(&'ll Type, &'ll Value)>>,

intrinsics:
RefCell<FxHashMap<(&'static str, SmallVec<[&'ll Type; 2]>), (&'ll Type, &'ll Value)>>,
RefCell<FxHashMap<(Cow<'static, str>, SmallVec<[&'ll Type; 2]>), (&'ll Type, &'ll Value)>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Did this become a Cow because previously everything was indirected via the &'static strs in declare_intrinsic, and now no longer is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to reduce some allocations (because most intrinsic names are string literals, but some are generated by format!). String would work as well. Should I change it?

Copy link
Member

Choose a reason for hiding this comment

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

It should be fine.

@sayantn sayantn force-pushed the simplify-intrinsics branch from 7504607 to 3dc8ebc Compare June 15, 2025 16:45
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

There is one more place where we should use val_ty instead of type_ptr - in va_copy. But there the LLVM signature is (0, 0) -> void, and the Rust signature is like (*mut T, &T) -> void. Is it guaranteed that *mut T and &T have the same LLVM address space (T is Sized)? Otherwise we might need to add some addressspacecasts to make it sound.

@nikic
Copy link
Contributor

nikic commented Jun 15, 2025

There is one more place where we should use val_ty instead of type_ptr - in va_copy. But there the LLVM signature is (0, 0) -> void, and the Rust signature is like (*mut T, &T) -> void. Is it guaranteed that *mut T and &T have the same LLVM address space (T is Sized)? Otherwise we might need to add some addressspacecasts to make it sound.

Yes, I believe this is guaranteed.

@sayantn
Copy link
Contributor Author

sayantn commented Jun 15, 2025

Nice, then I am changing that too

edit: I mean using val_ty instead of type_ptr

@sayantn sayantn force-pushed the simplify-intrinsics branch from 3dc8ebc to a9500d6 Compare June 15, 2025 17:19
@workingjubilee
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

📌 Commit a9500d6 has been approved by workingjubilee

It is now in the queue for this repository.

@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 Jun 15, 2025
@workingjubilee
Copy link
Member

@bors r=nikic,workingjubilee

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

📌 Commit a9500d6 has been approved by nikic,workingjubilee

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 16, 2025

⌛ Testing commit a9500d6 with merge 68ac5ab...

@bors
Copy link
Collaborator

bors commented Jun 16, 2025

☀️ Test successful - checks-actions
Approved by: nikic,workingjubilee
Pushing 68ac5ab to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 16, 2025
@bors bors merged commit 68ac5ab into rust-lang:master Jun 16, 2025
11 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 16, 2025
Copy link
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 e314b97 (parent) -> 68ac5ab (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 68ac5abb067806a88464ddbfbd3c7eec877b488d --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. x86_64-apple-2: 4492.8s -> 3437.3s (-23.5%)
  2. dist-x86_64-apple: 9719.0s -> 11073.5s (13.9%)
  3. i686-gnu-2: 6098.5s -> 5398.0s (-11.5%)
  4. mingw-check-1: 1877.1s -> 1685.1s (-10.2%)
  5. x86_64-apple-1: 7080.0s -> 6425.2s (-9.2%)
  6. x86_64-rust-for-linux: 2831.3s -> 2578.8s (-8.9%)
  7. x86_64-gnu-aux: 6486.8s -> 5916.8s (-8.8%)
  8. i686-gnu-1: 8029.5s -> 7324.0s (-8.8%)
  9. i686-gnu-nopt-1: 8000.6s -> 7313.0s (-8.6%)
  10. arm-android: 5946.2s -> 5473.2s (-8.0%)
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
Collaborator

Finished benchmarking commit (68ac5ab): comparison URL.

Overall result: ❌✅ regressions and 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)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary 2.2%, secondary -9.4%)

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

mean range count
Regressions ❌
(primary)
2.2% [2.2%, 2.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-9.4% [-9.4%, -9.4%] 1
All ❌✅ (primary) 2.2% [2.2%, 2.2%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 756.881s -> 757.272s (0.05%)
Artifact size: 372.07 MiB -> 372.17 MiB (0.03%)

@sayantn sayantn deleted the simplify-intrinsics branch July 27, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation 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. 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.

8 participants