Use the aligned size for alloca at ret when the pass mode is cast.
This commit is contained in:
@@ -230,10 +230,20 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
let layout = start_bx.layout_of(fx.monomorphize(decl.ty));
|
||||
assert!(!layout.ty.has_erasable_regions());
|
||||
|
||||
if local == mir::RETURN_PLACE && fx.fn_abi.ret.is_indirect() {
|
||||
debug!("alloc: {:?} (return place) -> place", local);
|
||||
let llretptr = start_bx.get_param(0);
|
||||
return LocalRef::Place(PlaceRef::new_sized(llretptr, layout));
|
||||
if local == mir::RETURN_PLACE {
|
||||
match fx.fn_abi.ret.mode {
|
||||
PassMode::Indirect { .. } => {
|
||||
debug!("alloc: {:?} (return place) -> place", local);
|
||||
let llretptr = start_bx.get_param(0);
|
||||
return LocalRef::Place(PlaceRef::new_sized(llretptr, layout));
|
||||
}
|
||||
PassMode::Cast { ref cast, .. } => {
|
||||
debug!("alloc: {:?} (return place) -> place", local);
|
||||
let size = cast.size(&start_bx);
|
||||
return LocalRef::Place(PlaceRef::alloca_size(&mut start_bx, size, layout));
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
|
||||
if memory_locals.contains(local) {
|
||||
|
||||
Reference in New Issue
Block a user