Skip to content

Commit 2cb8a31

Browse files
committed
Auto merge of #26595 - dotdash:fca_slice, r=eddyb
Storing them as FCAs is a regression from the recent change that made fat pointers immediate return values so that they are passed in registers instead of memory.
2 parents 378a370 + 2051b3e commit 2cb8a31

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustc_trans/trans/base.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,14 @@ pub fn store_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t
832832
return;
833833
}
834834

835-
let store = Store(cx, from_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t));
836-
unsafe {
837-
llvm::LLVMSetAlignment(store, type_of::align_of(cx.ccx(), t));
835+
if common::type_is_fat_ptr(cx.tcx(), t) {
836+
Store(cx, ExtractValue(cx, v, abi::FAT_PTR_ADDR), expr::get_dataptr(cx, dst));
837+
Store(cx, ExtractValue(cx, v, abi::FAT_PTR_EXTRA), expr::get_len(cx, dst));
838+
} else {
839+
let store = Store(cx, from_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t));
840+
unsafe {
841+
llvm::LLVMSetAlignment(store, type_of::align_of(cx.ccx(), t));
842+
}
838843
}
839844
}
840845

0 commit comments

Comments
 (0)