Skip to content

Commit

Permalink
Codegen: Combine two PointerCasts into one
Browse files Browse the repository at this point in the history
Shaves off a percent or so from the LLVM passes for librustc.
  • Loading branch information
dotdash committed Jun 11, 2013
1 parent d0b1979 commit f526434
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

5 comments on commit f526434

@bors
Copy link
Contributor

@bors bors commented on f526434 Jun 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from graydon
at dotdash@f526434

@bors
Copy link
Contributor

@bors bors commented on f526434 Jun 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging dotdash/rust/cast_combine = f526434 into auto

@bors
Copy link
Contributor

@bors bors commented on f526434 Jun 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotdash/rust/cast_combine = f526434 merged ok, testing candidate = 7033dfc

@bors
Copy link
Contributor

@bors bors commented on f526434 Jun 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on f526434 Jun 12, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 7033dfc

Please sign in to comment.