2023-09-20 16:43:33 -05:00
|
|
|
//@ unit-test: GVN
|
2023-04-28 11:51:40 -05:00
|
|
|
|
2023-09-20 16:43:33 -05:00
|
|
|
// EMIT_MIR address_of_pair.fn0.GVN.diff
|
2023-04-28 11:51:40 -05:00
|
|
|
pub fn fn0() -> bool {
|
2023-12-02 14:16:25 -06:00
|
|
|
// CHECK-LABEL: fn fn0(
|
|
|
|
// CHECK: debug pair => [[pair:_.*]];
|
|
|
|
// CHECK: debug ptr => [[ptr:_.*]];
|
|
|
|
// CHECK: debug ret => [[ret:_.*]];
|
|
|
|
// CHECK: (*[[ptr]]) = const true;
|
|
|
|
// CHECK-NOT: = const false;
|
|
|
|
// CHECK-NOT: = const true;
|
|
|
|
// CHECK: [[tmp:_.*]] = ([[pair]].1: bool);
|
|
|
|
// CHECK-NOT: = const false;
|
|
|
|
// CHECK-NOT: = const true;
|
|
|
|
// CHECK: [[ret]] = Not(move [[tmp]]);
|
|
|
|
// CHECK-NOT: = const false;
|
|
|
|
// CHECK-NOT: = const true;
|
|
|
|
// CHECK: _0 = [[ret]];
|
2023-04-28 11:51:40 -05:00
|
|
|
let mut pair = (1, false);
|
|
|
|
let ptr = core::ptr::addr_of_mut!(pair.1);
|
|
|
|
pair = (1, false);
|
|
|
|
unsafe {
|
|
|
|
*ptr = true;
|
|
|
|
}
|
|
|
|
let ret = !pair.1;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
println!("{}", fn0());
|
|
|
|
}
|