about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-10-22 18:10:59 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-10-22 18:10:59 +0000
commit56c6c86661498c61a0f877e43c9e6aa928882fa1 (patch)
treeb285ba1210c2590a52ff6daeb07627bab4fb5ca5
parent55380a5ffd72bb2ab601e911409cdd092a2740d9 (diff)
downloadrust-56c6c86661498c61a0f877e43c9e6aa928882fa1.tar.gz
rust-56c6c86661498c61a0f877e43c9e6aa928882fa1.zip
Simplify FunctionCx::create_stack_slot a bit
-rw-r--r--src/common.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/common.rs b/src/common.rs
index 7a0b04c09cc..9771f44f62c 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -395,13 +395,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
         } else {
             // Alignment is too big to handle using the above hack. Dynamically realign a stack slot
             // instead. This wastes some space for the realignment.
-            let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData {
-                kind: StackSlotKind::ExplicitSlot,
-                // FIXME is this calculation to ensure there is enough space to dyanmically realign
-                // as well as keep a 16 byte realignment for the other stack slots correct?
-                size: ((size + align - 1) + 16) / 16 * 16,
-            });
-            let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0);
+            let base_ptr = self.create_stack_slot(size + align, 16).get_addr(self);
             let misalign_offset = self.bcx.ins().urem_imm(base_ptr, i64::from(align));
             let realign_offset = self.bcx.ins().irsub_imm(misalign_offset, i64::from(align));
             Pointer::new(self.bcx.ins().iadd(base_ptr, realign_offset))