Skip to content

Commit

Permalink
Delete ConstDebugInfo pass
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed Jun 10, 2024
1 parent 476f46a commit 8fbab18
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 125 deletions.
103 changes: 0 additions & 103 deletions compiler/rustc_mir_transform/src/const_debuginfo.rs

This file was deleted.

2 changes: 0 additions & 2 deletions compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ mod remove_place_mention;
// This pass is public to allow external drivers to perform MIR cleanup
mod add_subtyping_projections;
pub mod cleanup_post_borrowck;
mod const_debuginfo;
mod copy_prop;
mod coroutine;
mod cost_checker;
Expand Down Expand Up @@ -595,7 +594,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&simplify::SimplifyLocals::AfterGVN,
&dataflow_const_prop::DataflowConstProp,
&single_use_consts::SingleUseConsts,
&const_debuginfo::ConstDebugInfo,
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),
&jump_threading::JumpThreading,
&early_otherwise_branch::EarlyOtherwiseBranch,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- // MIR for `main` before ConstDebugInfo
+ // MIR for `main` after ConstDebugInfo
- // MIR for `main` before SingleUseConsts
+ // MIR for `main` after SingleUseConsts

fn main() -> () {
let mut _0: ();
Expand Down Expand Up @@ -56,39 +56,53 @@

bb0: {
nop;
_1 = const 1_u8;
- _1 = const 1_u8;
nop;
_2 = const 2_u8;
- _2 = const 2_u8;
nop;
_3 = const 3_u8;
- _3 = const 3_u8;
+ nop;
+ nop;
+ nop;
StorageLive(_4);
StorageLive(_5);
StorageLive(_6);
_6 = const 1_u8;
- _6 = const 1_u8;
+ nop;
StorageLive(_7);
_7 = const 2_u8;
_5 = const 3_u8;
- _7 = const 2_u8;
- _5 = const 3_u8;
+ nop;
+ nop;
StorageDead(_7);
StorageDead(_6);
StorageLive(_8);
_8 = const 3_u8;
_4 = const 6_u8;
- _8 = const 3_u8;
- _4 = const 6_u8;
+ nop;
+ nop;
StorageDead(_8);
StorageDead(_5);
StorageLive(_9);
_9 = const "hello, world!";
- _9 = const "hello, world!";
+ nop;
StorageLive(_10);
_10 = (const true, const false, const 123_u32);
StorageLive(_11);
_11 = const Option::<u16>::Some(99_u16);
- _11 = const Option::<u16>::Some(99_u16);
+ nop;
StorageLive(_12);
_12 = const Point {{ x: 32_u32, y: 32_u32 }};
- _12 = const Point {{ x: 32_u32, y: 32_u32 }};
+ nop;
StorageLive(_13);
nop;
_14 = const 32_u32;
- _14 = const 32_u32;
+ nop;
StorageLive(_15);
_15 = const 32_u32;
_13 = const 64_u32;
- _15 = const 32_u32;
- _13 = const 64_u32;
+ nop;
+ nop;
StorageDead(_15);
nop;
_0 = const ();
Expand Down
6 changes: 4 additions & 2 deletions tests/mir-opt/const_debuginfo.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//@ test-mir-pass: ConstDebugInfo
//@ test-mir-pass: SingleUseConsts
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN

#![allow(unused)]

struct Point {
x: u32,
y: u32,
}

// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
// EMIT_MIR const_debuginfo.main.SingleUseConsts.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => const 1_u8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
+ let mut _2: bool;
+ let mut _3: bool;
+ scope 2 {
+ debug buffer => const inner::promoted[0];
+ debug buffer => _1;
+ scope 3 {
+ debug index => _0;
+ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
+ let mut _2: bool;
+ let mut _3: bool;
+ scope 2 {
+ debug buffer => const inner::promoted[0];
+ debug buffer => _1;
+ scope 3 {
+ debug index => _0;
+ }
Expand Down

0 comments on commit 8fbab18

Please sign in to comment.