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

InstCombine away intrinsic validity assertions #105582

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Dec 12, 2022

This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.

@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2022

r? @petrochenkov

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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. labels Dec 12, 2022
@saethlin saethlin marked this pull request as ready for review December 12, 2022 02:09
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@saethlin
Copy link
Member Author

@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 Dec 12, 2022
@bors
Copy link
Contributor

bors commented Dec 12, 2022

⌛ Trying commit 2d86c3c5de3b4cf8c1a7f0d51f5466a1b2120586 with merge 7893106e07baf9fba3abcd2391134f6cf939f6f2...

@bors
Copy link
Contributor

bors commented Dec 12, 2022

☀️ Try build successful - checks-actions
Build commit: 7893106e07baf9fba3abcd2391134f6cf939f6f2 (7893106e07baf9fba3abcd2391134f6cf939f6f2)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7893106e07baf9fba3abcd2391134f6cf939f6f2): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

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-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.4% [1.4%, 1.4%] 1
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) -0.6% [-0.6%, -0.6%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.1% [1.0%, 3.3%] 2
Regressions ❌
(secondary)
2.2% [1.7%, 2.9%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.9%] 1
All ❌✅ (primary) 2.1% [1.0%, 3.3%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 12, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Dec 12, 2022

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned petrochenkov Dec 12, 2022
@saethlin
Copy link
Member Author

saethlin commented Jan 9, 2023

Waiting on DestProp improvement
@rustbot label +S-blocked

@rustbot rustbot added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Jan 9, 2023
@saethlin
Copy link
Member Author

Not sure why I said this was blocked on DestProp improvement. I didn't want this merged originally because it made #106141 easier to hit. But that issue is fixed now thanks to @cjgillot so I think this is good to go.

@rustbot label -S-blocked

@rustbot rustbot removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Jan 16, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jan 16, 2023

r? @cjgillot feel free to bounce back if preferred

@rustbot rustbot assigned cjgillot and unassigned oli-obk Jan 16, 2023
@bors
Copy link
Contributor

bors commented Jan 21, 2023

⌛ Testing commit 662199f with merge ed9d19a24db785dd6b0b49eead9328842892e10e...

@bors
Copy link
Contributor

bors commented Jan 21, 2023

💔 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 Jan 21, 2023
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

Failure is legit. The permits_{uninit,zero}_init queries should take a ParamEnv instead of inventing their own.

@rustbot
Copy link
Collaborator

rustbot commented Jan 22, 2023

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 24, 2023

📌 Commit 5bfad5c has been approved by cjgillot

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 Jan 24, 2023
@bors
Copy link
Contributor

bors commented Jan 26, 2023

⌛ Testing commit 5bfad5c with merge 885bf62...

@bors
Copy link
Contributor

bors commented Jan 26, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 885bf62 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 26, 2023
@bors bors merged commit 885bf62 into rust-lang:master Jan 26, 2023
@rustbot rustbot added this to the 1.69.0 milestone Jan 26, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (885bf62): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 6
Improvements ✅
(secondary)
-0.6% [-1.3%, -0.3%] 4
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 6

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Cycles

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

*target = None;
} else {
// If we know the assert does not panic, turn the call into a Goto
terminator.kind = TerminatorKind::Goto { target: *target_block };
Copy link
Member

Choose a reason for hiding this comment

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

I don't think I entirely understand the point of this. The intrinsic will anyway compile to a goto in this case. It's not like this ever becomes a runtime check. So what is the win here?

Copy link
Member

Choose a reason for hiding this comment

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

After SimplifyCfg the goto will be gone, shrinking the mir slightly. Also having to evaluate the intrinsic every time you monomorphize is slightly more expensive than evaluating it once at mir optimization time.

bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Feb 9, 2023
…d, r=cjgillot

InstCombine away intrinsic validity assertions

This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
qinheping added a commit to qinheping/kani that referenced this pull request Mar 9, 2023
(GeneratorWitnessMIR)
Compute generator saved locals on MIR rust-lang/rust#101692

(ParamEnv)
InstCombine away intrinsic validity assertions rust-lang/rust#105582

(Primitive::Pointer) abi: add AddressSpace field to Primitive::Pointer  rust-lang/rust#107248
qinheping added a commit to qinheping/kani that referenced this pull request Mar 9, 2023
(GeneratorWitnessMIR)
Compute generator saved locals on MIR rust-lang/rust#101692

(ParamEnv)
InstCombine away intrinsic validity assertions rust-lang/rust#105582

(Primitive::Pointer) abi: add AddressSpace field to Primitive::Pointer  rust-lang/rust#107248
@saethlin saethlin deleted the instcombine-assert-inhabited branch March 15, 2023 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations 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.

10 participants