Returns values up to 2*usize by value

This commit is contained in:
Jonas Schievink 2020-10-02 00:23:25 +02:00
parent 8fe73e80d7
commit b01694e0a2
2 changed files with 3 additions and 14 deletions

View file

@ -2787,8 +2787,9 @@ where
_ => return,
}
let max_by_val_size =
if is_ret { call::max_ret_by_val(cx) } else { Pointer.size(cx) };
// Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
// will usually return these in 2 registers, which is more efficient than by-ref.
let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) };
let size = arg.layout.size;
if arg.layout.is_unsized() || size > max_by_val_size {