Disconnect rustc_codegen_ssa from rustc_mir_transform - #162678
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @mejrs rustbot has assigned @mejrs. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
(On my system the cores are already fully saturated during this part of the build, but dropping a crate dependency is still nice.) |
|
|
||
| hook find_noop_landing_pads( | ||
| body: &mir::Body<'tcx>, | ||
| extra: Option<(ty::Instance<'tcx>, ty::TypingEnv<'tcx>)>, |
There was a problem hiding this comment.
Since the hook is only used post-mono, the signature could be simpler (require Instance and TypingEnv as separate parameters). That requires a little glue code for the hook impl, but that seems worth it to me to have a simpler interface that needs less documentation (the impl is documented but that's not easily accessible when looking at hook definition or hook call sites).
Alternatively, if you'd prefer to keep the general signature, then I'd ask for the hook itself to be documented.
There was a problem hiding this comment.
I considered both versions, and in hindsight I think you're right to push for the simpler signature.
| /// Called directly by [`RemoveNoopLandingPads`], and is also the hook impl for | ||
| /// [`TyCtxt::find_noop_landing_pads`], which can be called from other crates. |
There was a problem hiding this comment.
Removing the ExtraInfo type is fine, but the clue from its documentation that it's for codegen to get more precise analysis results post-mono should be preserved.
The direct dependency from `rustc_codegen_ssa` to `rustc_mir_transform` allowed codegen to reuse some MIR-transform code for identifying unnecessary landing pads. However, we can achieve the same result by calling through a hook on `TyCtxt`, eliminating the crate dependency.
a477649 to
df15f02
Compare
|
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. |
|
Thanks, r=me when CI is green |
|
@bors r+ |
…uwer Rollup of 6 pull requests Successful merges: - #162623 (Use GrowableBitSet in the main loop of `rustc_mir_transform::sroa`) - #162678 (Disconnect `rustc_codegen_ssa` from `rustc_mir_transform`) - #162641 (Remove unused arguments of functions) - #162663 (Rustdoc issue template: fix typo in comment ("thorugh")) - #162684 (Add `E0747` explanation for `type/const` mismatch case) - #162685 (Stabilize `Vec::from_fn`)
…uwer Rollup of 6 pull requests Successful merges: - #162623 (Use GrowableBitSet in the main loop of `rustc_mir_transform::sroa`) - #162678 (Disconnect `rustc_codegen_ssa` from `rustc_mir_transform`) - #162641 (Remove unused arguments of functions) - #162663 (Rustdoc issue template: fix typo in comment ("thorugh")) - #162684 (Add `E0747` explanation for `type/const` mismatch case) - #162685 (Stabilize `Vec::from_fn`)
Rollup merge of #162678 - Zalathar:ssa-transform, r=hanna-kruppe Disconnect `rustc_codegen_ssa` from `rustc_mir_transform` The direct dependency from `rustc_codegen_ssa` to `rustc_mir_transform` allowed codegen to reuse some MIR-transform code for identifying unnecessary landing pads (for #143208). However, we can achieve the same result by calling through a hook on `TyCtxt`, eliminating the crate dependency. --- There should be no change to compiler output.
The direct dependency from
rustc_codegen_ssatorustc_mir_transformallowed codegen to reuse some MIR-transform code for identifying unnecessary landing pads (for #143208).However, we can achieve the same result by calling through a hook on
TyCtxt, eliminating the crate dependency.There should be no change to compiler output.