Skip to content

Commit

Permalink
Use worse MIR for incr comp
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Oct 24, 2024
1 parent 5ee22f1 commit 4ae3542
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ pub(crate) fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
// release builds.
info!("codegen_instance({})", instance);

mir::codegen_mir::<Bx>(cx, instance);
mir::lower_mir::<Bx>(cx, instance);
}

/// Creates the `main` function which will initialize the rust runtime and call
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl<'tcx, V: CodegenObject> LocalRef<'tcx, V> {
///////////////////////////////////////////////////////////////////////////

#[instrument(level = "debug", skip(cx))]
pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
pub fn lower_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
cx: &'a Bx::CodegenCx,
instance: Instance<'tcx>,
) {
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,14 @@ impl<'tcx> TyCtxt<'tcx> {
}
}

pub fn codegen_mir(self, instance: ty::Instance<'tcx>) -> &'tcx Body<'tcx> {
if self.sess.opts.incremental == None {
self.build_codegen_mir(instance)
} else {
self.instance_mir(instance.def)
}
}

/// Returns the possibly-auto-generated MIR of a [`ty::InstanceKind`].
#[instrument(skip(self), level = "debug")]
pub fn instance_mir(self, instance: ty::InstanceKind<'tcx>) -> &'tcx Body<'tcx> {
Expand Down

0 comments on commit 4ae3542

Please sign in to comment.