From f526434197be4395709b6354d746d9954ff5471c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Tue, 11 Jun 2013 22:42:55 +0200 Subject: [PATCH] Codegen: Combine two PointerCasts into one Shaves off a percent or so from the LLVM passes for librustc. --- src/librustc/middle/trans/base.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 8e015d9a677..c1bc27bea3f 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -268,9 +268,8 @@ pub fn opaque_box_body(bcx: block, boxptr: ValueRef) -> ValueRef { let _icx = bcx.insn_ctxt("opaque_box_body"); let ccx = bcx.ccx(); - let boxptr = PointerCast(bcx, boxptr, T_ptr(T_box_header(ccx))); - let bodyptr = GEPi(bcx, boxptr, [1u]); - PointerCast(bcx, bodyptr, T_ptr(type_of(ccx, body_t))) + let boxptr = PointerCast(bcx, boxptr, T_ptr(T_box(ccx, type_of(ccx, body_t)))); + GEPi(bcx, boxptr, [0u, abi::box_field_body]) } // malloc_raw_dyn: allocates a box to contain a given type, but with a