Skip to content

Commit 4e03ffd

Browse files
committed
rustc: optimize away some mallocs when building GEP args
1 parent e28a161 commit 4e03ffd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/rustc/middle/trans/build.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef {
433433
//
434434
// XXX: Use a small-vector optimization to avoid allocations here.
435435
fn GEPi(cx: block, base: ValueRef, ixs: &[uint]) -> ValueRef {
436-
let mut v: ~[ValueRef] = ~[];
437-
for vec::each(ixs) |i| { v.push(C_i32(*i as i32)); }
436+
let v = do vec::map(ixs) |i| { C_i32(*i as i32) };
438437
count_insn(cx, "gepi");
439438
return InBoundsGEP(cx, base, v);
440439
}

0 commit comments

Comments
 (0)