Replace locals in debuginfo records during dest_prop

This commit is contained in:
dianqk
2025-10-10 13:50:01 +08:00
parent b2e81b00e5
commit 1ee2c58e89
4 changed files with 9 additions and 4 deletions
@@ -277,7 +277,6 @@ fn visit_statement(&mut self, statement: &mut Statement<'tcx>, location: Locatio
if self.merged_locals.contains(*local) =>
{
statement.make_nop(true);
return;
}
_ => (),
};
@@ -9,11 +9,12 @@
let mut _4: bool;
bb0: {
// DBG: _3 = &_1;
- // DBG: _3 = &_1;
- StorageLive(_4);
- _4 = copy _1;
- _3 = copy _2;
- switchInt(copy _4) -> [1: bb1, otherwise: bb2];
+ // DBG: _2 = &_1;
+ nop;
+ nop;
+ nop;
+4 -1
View File
@@ -1,4 +1,3 @@
// skip-filecheck
//@ test-mir-pass: DestinationPropagation
//@ compile-flags: -g -Zmir-enable-passes=+DeadStoreElimination-initial
@@ -10,6 +9,10 @@
// EMIT_MIR dest_prop.remap_debuginfo_locals.DestinationPropagation.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub fn remap_debuginfo_locals(a: bool, b: &bool) -> &bool {
// CHECK-LABEL: fn remap_debuginfo_locals(
// CHECK: debug c => [[c:_.*]];
// CHECK: bb0:
// CHECK-NEXT: DBG: [[c]] = &_1;
mir! {
let _3: &bool;
let _4: bool;
@@ -1,6 +1,8 @@
//@ known-bug: #147485
//@ build-pass
//@ compile-flags: -g -O
// Regression test for #147485.
#![crate_type = "lib"]
pub fn foo(a: bool, b: bool) -> bool {