Skip to content

Commit

Permalink
FileCheck ref_deref.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent c8c9207 commit 6baec3c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
5 changes: 4 additions & 1 deletion tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
let mut _2: &i32;
let _3: i32;
let mut _4: &i32;
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand All @@ -15,8 +18,8 @@
_2 = &(*_4);
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
8 changes: 5 additions & 3 deletions tests/mir-opt/const_prop/ref_deref.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR ref_deref.main.ConstProp.diff

// EMIT_MIR ref_deref.main.ConstProp.diff
fn main() {
*(&4);
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
// CHECK: [[a]] = (*{{_.*}});
let a = *(&4);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
let mut _2: &i32;
let _3: (i32, i32);
let mut _4: &(i32, i32);
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand All @@ -15,8 +18,8 @@
_2 = &((*_4).1: i32);
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
9 changes: 6 additions & 3 deletions tests/mir-opt/const_prop/ref_deref_project.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// skip-filecheck
// This does not currently propagate (#67862)
// unit-test: ConstProp
// EMIT_MIR ref_deref_project.main.ConstProp.diff

// EMIT_MIR ref_deref_project.main.ConstProp.diff
fn main() {
*(&(4, 5).1); // This does not currently propagate (#67862)
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
// CHECK: [[a]] = (*{{_.*}});
let a = *(&(4, 5).1);
}

0 comments on commit 6baec3c

Please sign in to comment.