From 15b9834d7d37d601fd77db11f8852f9ceb0804d0 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 30 Aug 2019 15:41:33 +0200 Subject: Don't copy ByRef passed types to local stack slot when not necessary Eg when the local is immutable **and** the type is freeze. This makes the simple raytracer runtime benchmark 1% faster than cg_llvm without optimizations. Before it was 2% slower. cc #691 cc #684 --- example/example.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'example/example.rs') diff --git a/example/example.rs b/example/example.rs index e8ddc4aaea1..5878e8548d9 100644 --- a/example/example.rs +++ b/example/example.rs @@ -202,3 +202,7 @@ fn get_sized_field_ref_from_unsized_type(u: &Unsized) -> &u8 { fn get_unsized_field_ref_from_unsized_type(u: &Unsized) -> &str { &u.1 } + +pub fn reuse_byref_argument_storage(a: (u8, u16, u32)) -> u8 { + a.0 +} -- cgit 1.4.1-3-g733a5