summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_mir_transform/src/sroa.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_mir_transform/src/sroa.rs')
-rw-r--r--compiler/rustc_mir_transform/src/sroa.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs
index 94e1da8e1..e66ae8ff8 100644
--- a/compiler/rustc_mir_transform/src/sroa.rs
+++ b/compiler/rustc_mir_transform/src/sroa.rs
@@ -12,7 +12,7 @@ pub struct ScalarReplacementOfAggregates;
impl<'tcx> MirPass<'tcx> for ScalarReplacementOfAggregates {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
- sess.mir_opt_level() >= 3
+ sess.mir_opt_level() >= 2
}
#[instrument(level = "debug", skip(self, tcx, body))]
@@ -20,7 +20,7 @@ impl<'tcx> MirPass<'tcx> for ScalarReplacementOfAggregates {
debug!(def_id = ?body.source.def_id());
// Avoid query cycles (generators require optimized MIR for layout).
- if tcx.type_of(body.source.def_id()).subst_identity().is_generator() {
+ if tcx.type_of(body.source.def_id()).instantiate_identity().is_generator() {
return;
}
@@ -64,7 +64,7 @@ fn escaping_locals<'tcx>(
if ty.is_union() || ty.is_enum() {
return true;
}
- if let ty::Adt(def, _substs) = ty.kind() {
+ if let ty::Adt(def, _args) = ty.kind() {
if def.repr().flags.contains(ReprFlags::IS_SIMD) {
// Exclude #[repr(simd)] types so that they are not de-optimized into an array
return true;
@@ -161,7 +161,9 @@ struct ReplacementMap<'tcx> {
impl<'tcx> ReplacementMap<'tcx> {
fn replace_place(&self, tcx: TyCtxt<'tcx>, place: PlaceRef<'tcx>) -> Option<Place<'tcx>> {
- let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else { return None; };
+ let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else {
+ return None;
+ };
let fields = self.fragments[place.local].as_ref()?;
let (_, new_local) = fields[f]?;
Some(Place { local: new_local, projection: tcx.mk_place_elems(&rest) })