trans: use Pair for ignored nil pairs instead of Immediate.
This commit is contained in:
parent
8cbffc5bcf
commit
b6d9f8387a
2 changed files with 18 additions and 1 deletions
|
@ -124,7 +124,12 @@ impl<'tcx> TempRef<'tcx> {
|
||||||
// Zero-size temporaries aren't always initialized, which
|
// Zero-size temporaries aren't always initialized, which
|
||||||
// doesn't matter because they don't contain data, but
|
// doesn't matter because they don't contain data, but
|
||||||
// we need something in the operand.
|
// we need something in the operand.
|
||||||
let val = OperandValue::Immediate(common::C_nil(ccx));
|
let nil = common::C_nil(ccx);
|
||||||
|
let val = if common::type_is_imm_pair(ccx, ty) {
|
||||||
|
OperandValue::Pair(nil, nil)
|
||||||
|
} else {
|
||||||
|
OperandValue::Immediate(nil)
|
||||||
|
};
|
||||||
let op = OperandRef {
|
let op = OperandRef {
|
||||||
val: val,
|
val: val,
|
||||||
ty: ty
|
ty: ty
|
||||||
|
|
|
@ -147,6 +147,16 @@ fn test_fn_transmute_zst(x: ()) -> [(); 1] {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustc_mir]
|
||||||
|
fn test_fn_ignored_pair() -> ((), ()) {
|
||||||
|
((), ())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[rustc_mir]
|
||||||
|
fn test_fn_ignored_pair_0() {
|
||||||
|
test_fn_ignored_pair().0
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert_eq!(test1(1, (2, 3), &[4, 5, 6]), (1, (2, 3), &[4, 5, 6][..]));
|
assert_eq!(test1(1, (2, 3), &[4, 5, 6]), (1, (2, 3), &[4, 5, 6][..]));
|
||||||
assert_eq!(test2(98), 98);
|
assert_eq!(test2(98), 98);
|
||||||
|
@ -169,4 +179,6 @@ fn main() {
|
||||||
|
|
||||||
assert_eq!(test_fn_nil_call(&(|| 42)), 42);
|
assert_eq!(test_fn_nil_call(&(|| 42)), 42);
|
||||||
assert_eq!(test_fn_transmute_zst(()), [()]);
|
assert_eq!(test_fn_transmute_zst(()), [()]);
|
||||||
|
|
||||||
|
assert_eq!(test_fn_ignored_pair_0(), ());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue