Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b141564

Browse files
committedOct 13, 2024
Auto merge of rust-lang#131650 - saethlin:post-mono-mir-opts, r=<try>
Add post-mono MIR passes to make mono-reachable analysis more accurate r? ghost
2 parents 3678036 + a211812 commit b141564

File tree

49 files changed

+323
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+323
-393
lines changed
 

‎compiler/rustc_codegen_cranelift/src/base.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) fn codegen_fn<'tcx>(
4141
let symbol_name = tcx.symbol_name(instance).name.to_string();
4242
let _timer = tcx.prof.generic_activity_with_arg("codegen fn", &*symbol_name);
4343

44-
let mir = tcx.instance_mir(instance.def);
44+
let mir = tcx.build_codegen_mir(instance);
4545
let _mir_guard = crate::PrintOnPanic(|| {
4646
let mut buf = Vec::new();
4747
with_no_trimmed_paths!({

‎compiler/rustc_codegen_ssa/src/mir/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
167167

168168
let llfn = cx.get_fn(instance);
169169

170-
let mir = cx.tcx().instance_mir(instance.def);
170+
let mir = cx.tcx().build_codegen_mir(instance);
171171

172172
let fn_abi = cx.fn_abi_of_instance(instance, ty::List::empty());
173173
debug!("fn_abi: {:?}", fn_abi);

‎compiler/rustc_middle/src/mir/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ impl RuntimePhase {
159159
"initial" => Self::Initial,
160160
"post_cleanup" | "post-cleanup" | "postcleanup" => Self::PostCleanup,
161161
"optimized" => Self::Optimized,
162+
"codegen" => Self::Codegen,
162163
_ => bug!("Unknown runtime phase: '{}'", phase),
163164
}
164165
}

‎compiler/rustc_middle/src/mir/mono.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'tcx> MonoItem<'tcx> {
7373
InstanceKind::Item(..)
7474
| InstanceKind::DropGlue(..)
7575
| InstanceKind::AsyncDropGlueCtorShim(..) => {
76-
let mir = tcx.instance_mir(instance.def);
76+
let mir = tcx.build_codegen_mir(instance);
7777
mir.basic_blocks.iter().map(|bb| bb.statements.len() + 1).sum()
7878
}
7979
// Other compiler-generated shims size estimate: 1

0 commit comments

Comments
 (0)