Skip to content

Commit f526434

Browse files
committed
Codegen: Combine two PointerCasts into one
Shaves off a percent or so from the LLVM passes for librustc.
1 parent d0b1979 commit f526434

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,8 @@ pub fn opaque_box_body(bcx: block,
268268
boxptr: ValueRef) -> ValueRef {
269269
let _icx = bcx.insn_ctxt("opaque_box_body");
270270
let ccx = bcx.ccx();
271-
let boxptr = PointerCast(bcx, boxptr, T_ptr(T_box_header(ccx)));
272-
let bodyptr = GEPi(bcx, boxptr, [1u]);
273-
PointerCast(bcx, bodyptr, T_ptr(type_of(ccx, body_t)))
271+
let boxptr = PointerCast(bcx, boxptr, T_ptr(T_box(ccx, type_of(ccx, body_t))));
272+
GEPi(bcx, boxptr, [0u, abi::box_field_body])
274273
}
275274

276275
// malloc_raw_dyn: allocates a box to contain a given type, but with a

0 commit comments

Comments
 (0)