forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#116183 - cjgillot:debug-dse-always, r=<try>
Always preserve DebugInfo in DeadStoreElimination. This is a version of rust-lang#106852 that does not check the current crate's debuginfo flag, and always attempts to preserve debuginfo. I haven't figured out how to handle mixing debuginfo levels for std, the one for the test, and the one for the CI target just right to merge rust-lang#106852, so this can at least fix the debuginfo issue. Fixes rust-lang#103655
- Loading branch information
Showing
33 changed files
with
759 additions
and
793 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use rustc_index::bit_set::BitSet; | ||
use rustc_middle::mir::visit::*; | ||
use rustc_middle::mir::*; | ||
|
||
/// Return the set of locals that appear in debuginfo. | ||
pub fn debuginfo_locals(body: &Body<'_>) -> BitSet<Local> { | ||
let mut visitor = DebuginfoLocals(BitSet::new_empty(body.local_decls.len())); | ||
for debuginfo in body.var_debug_info.iter() { | ||
visitor.visit_var_debug_info(debuginfo); | ||
} | ||
visitor.0 | ||
} | ||
|
||
struct DebuginfoLocals(BitSet<Local>); | ||
|
||
impl Visitor<'_> for DebuginfoLocals { | ||
fn visit_local(&mut self, local: Local, _: PlaceContext, _: Location) { | ||
self.0.insert(local); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
- // MIR for `cycle` before DeadStoreElimination | ||
+ // MIR for `cycle` after DeadStoreElimination | ||
|
||
fn cycle(_1: i32, _2: i32, _3: i32) -> () { | ||
let mut _0: (); | ||
let mut _4: bool; | ||
- let mut _5: i32; | ||
|
||
bb0: { | ||
_4 = cond() -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
switchInt(_4) -> [1: bb2, otherwise: bb3]; | ||
} | ||
|
||
bb2: { | ||
- _5 = _3; | ||
- _3 = _2; | ||
- _2 = _1; | ||
- _1 = _5; | ||
_4 = cond() -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb3: { | ||
return; | ||
} | ||
} | ||
|
73 changes: 0 additions & 73 deletions
73
tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
This file was deleted.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.