-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Substitute types before checking inlining compatibility. #113802
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@@ -440,6 +440,10 @@ impl<'tcx> Inliner<'tcx> { | |||
validation: Ok(()), | |||
}; | |||
|
|||
for var_debug_info in callee_body.var_debug_info.iter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(answered in: #113802 (comment) )
if ty == f_ty { | ||
return; | ||
} | ||
if !util::is_subtype(this.tcx, this.param_env, ty, f_ty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but why are we changing this from is_equal_up_to_subtyping
? I guess do we only want to check that ty <: f_ty
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(answered in: #113802 (comment) )
I should have put more context in the PR comment. This ad-hoc validation should reuse the existing MIR validation code, and not brew its own, but that's for another PR. |
6916910
to
45ffe41
Compare
@bors r+ |
I'm nominating for backport, as both ICEs affect stable 1.71.0. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6b29036): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 651.291s -> 649.721s (-0.24%) |
Prepare Rust 1.71.1 This PR prepares the Rust 1.71.1 release, which contains: * rust-lang#113802 * rust-lang#113579 * rust-lang#111516 * rust-lang#112517 * rust-lang@67b5990 (from rust-lang#113678) r? `@ghost` cc `@rust-lang/release`
[beta] backport * Restrict linker version script of proc-macro crates to just its two symbols rust-lang#114470 * bootstrap: config: fix version comparison bug rust-lang#114440 * lint/ctypes: only try normalize rust-lang#113921 * Avoid tls access while iterating through mpsc thread entries rust-lang#113861 * Substitute types before checking inlining compatibility. rust-lang#113802 * Revert "fix: bug etc/bash_complettion -> src/etc/... to avoid copy error" rust-lang#113579 * lint/ctypes: fix () return type checks rust-lang#113457 * Rename and allow cast_ref_to_mut lint rust-lang#113422 * Ignore flaky clippy tests. rust-lang#113621 r? cuviper
if ty == f_ty { | ||
return; | ||
} | ||
if !util::is_subtype(this.tcx, this.param_env, ty, f_ty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add a comment pointing to the issue(s), to give some context to this check.
Addresses #112332 and #113781
I don't have a minimal test, but I this seems to remove the ICE locally.
This whole pre-inlining validation mirrors the "real" MIR validation pass to verify that inlined MIR will still pass validation.
The debuginfo loop is added because MIR validation check projections in debuginfo.
Likewise, MIR validation only checks
is_subtype
, so there is no reason for a stronger check.The types were not being substituted in
check_equal
, so we were not bailing out of inlining if the substituted MIR callee body would not pass validation.