about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-06-19 20:56:21 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-06-19 20:56:21 +0000
commitdaf79b56859c3b446f7f2db09f3b4a6d21883ff2 (patch)
treef4f7e19ac2d5a1683ccaa6511616d33306286ec0
parentab836ca5e3a213b03d21de76230807c75cd34e6c (diff)
downloadrust-daf79b56859c3b446f7f2db09f3b4a6d21883ff2.tar.gz
rust-daf79b56859c3b446f7f2db09f3b4a6d21883ff2.zip
Avoid the stack in a couple more cases in write_cvalue_maybe_transmute
-rw-r--r--src/value_and_place.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index ab7b053c895..3506da27066 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -599,12 +599,13 @@ impl<'tcx> CPlace<'tcx> {
                 transmute_scalar(fx, var, data, dst_ty);
             }
             CPlaceInner::VarPair(_local, var1, var2) => {
-                let (data1, data2) = if from.layout().ty == dst_layout.ty {
-                    CValue(from.0, dst_layout).load_scalar_pair(fx)
-                } else {
-                    let (ptr, meta) = from.force_stack(fx);
-                    assert!(meta.is_none());
-                    CValue(CValueInner::ByRef(ptr, None), dst_layout).load_scalar_pair(fx)
+                let (data1, data2) = match from.1.abi {
+                    Abi::ScalarPair(_, _) => CValue(from.0, dst_layout).load_scalar_pair(fx),
+                    _ => {
+                        let (ptr, meta) = from.force_stack(fx);
+                        assert!(meta.is_none());
+                        CValue(CValueInner::ByRef(ptr, None), dst_layout).load_scalar_pair(fx)
+                    }
                 };
                 let (dst_ty1, dst_ty2) = fx.clif_pair_type(self.layout().ty).unwrap();
                 transmute_scalar(fx, var1, data1, dst_ty1);