Skip to content

Commit 56c6c86

Browse files
committed
Simplify FunctionCx::create_stack_slot a bit
1 parent 55380a5 commit 56c6c86

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/common.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
395395
} else {
396396
// Alignment is too big to handle using the above hack. Dynamically realign a stack slot
397397
// instead. This wastes some space for the realignment.
398-
let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData {
399-
kind: StackSlotKind::ExplicitSlot,
400-
// FIXME is this calculation to ensure there is enough space to dyanmically realign
401-
// as well as keep a 16 byte realignment for the other stack slots correct?
402-
size: ((size + align - 1) + 16) / 16 * 16,
403-
});
404-
let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0);
398+
let base_ptr = self.create_stack_slot(size + align, 16).get_addr(self);
405399
let misalign_offset = self.bcx.ins().urem_imm(base_ptr, i64::from(align));
406400
let realign_offset = self.bcx.ins().irsub_imm(misalign_offset, i64::from(align));
407401
Pointer::new(self.bcx.ins().iadd(base_ptr, realign_offset))

0 commit comments

Comments
 (0)