Skip to content

Commit 552f391

Browse files
olioli-obk
authored andcommitted
Make encode_optimized_mir always perform its action and instead require the callers to know whether they actually want this
1 parent 68ff5f0 commit 552f391

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,18 +1118,16 @@ impl EncodeContext<'a, 'tcx> {
11181118

11191119
fn encode_optimized_mir(&mut self, def_id: LocalDefId) {
11201120
debug!("EntryBuilder::encode_mir({:?})", def_id);
1121-
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) {
1122-
record!(self.tables.mir[def_id.to_def_id()] <- self.tcx.optimized_mir(def_id));
1121+
record!(self.tables.mir[def_id.to_def_id()] <- self.tcx.optimized_mir(def_id));
11231122

1124-
let unused = self.tcx.unused_generic_params(def_id);
1125-
if !unused.is_empty() {
1126-
record!(self.tables.unused_generic_params[def_id.to_def_id()] <- unused);
1127-
}
1123+
let unused = self.tcx.unused_generic_params(def_id);
1124+
if !unused.is_empty() {
1125+
record!(self.tables.unused_generic_params[def_id.to_def_id()] <- unused);
1126+
}
11281127

1129-
let abstract_const = self.tcx.mir_abstract_const(def_id);
1130-
if let Ok(Some(abstract_const)) = abstract_const {
1131-
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
1132-
}
1128+
let abstract_const = self.tcx.mir_abstract_const(def_id);
1129+
if let Ok(Some(abstract_const)) = abstract_const {
1130+
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
11331131
}
11341132
}
11351133

@@ -1413,8 +1411,10 @@ impl EncodeContext<'a, 'tcx> {
14131411
let needs_inline = (generics.requires_monomorphization(tcx)
14141412
|| tcx.codegen_fn_attrs(def_id).requests_inline())
14151413
&& !self.metadata_output_only();
1414+
1415+
let is_const_fn = sig.header.constness == hir::Constness::Const;
14161416
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
1417-
needs_inline || sig.header.constness == hir::Constness::Const || always_encode_mir
1417+
needs_inline || is_const_fn || always_encode_mir
14181418
}
14191419
_ => false,
14201420
};

0 commit comments

Comments
 (0)