1
Fork 0

Auto merge of #107404 - cjgillot:const-debuginfo, r=oli-obk

Turn on ConstDebugInfo pass.

Split from https://github.com/rust-lang/rust/pull/103657

Moving those constant into debuginfo allows to shrink the number of locals and the actual size of the MIR body.
This commit is contained in:
bors 2023-04-23 11:26:01 +00:00
commit 9e540df793
14 changed files with 85 additions and 82 deletions

View file

@ -494,6 +494,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let Some(dbg_loc) = self.dbg_loc(var.source_info) else { continue };
if let Ok(operand) = self.eval_mir_constant_to_operand(bx, &c) {
self.set_debug_loc(bx, var.source_info);
let base = Self::spill_operand_to_stack(
&operand,
Some(var.name.to_string()),

View file

@ -16,7 +16,7 @@ pub struct ConstDebugInfo;
impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
sess.opts.unstable_opts.unsound_mir_opts && sess.mir_opt_level() > 0
sess.mir_opt_level() > 0
}
fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {