Skip to content

Commit a72354a

Browse files
committed
---
yaml --- r: 5489 b: refs/heads/master c: 572a4b7 h: refs/heads/master i: 5487: f96a61a v: v3
1 parent c905a8c commit a72354a

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 64c69aa7b88b3ef66167f26cf681aaeeed33180e
2+
refs/heads/master: 572a4b71d5a906ab25a30025fc87529f123ee020

trunk/src/comp/middle/trans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,7 @@ fn join_returns(parent_cx: @block_ctxt, in_cxs: [@block_ctxt],
24552455
if option::is_none(phi) {
24562456
phi = some(EmptyPhi(out, val_ty(*cell)));
24572457
}
2458-
AddIncomingToPhi(option::get(phi), [*cell], [cx.llbb]);
2458+
AddIncomingToPhi(option::get(phi), *cell, cx.llbb);
24592459
}
24602460
_ {}
24612461
}

trunk/src/comp/middle/trans_build.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,11 @@ fn Phi(cx: @block_ctxt, Ty: TypeRef, vals: [ValueRef], bbs: [BasicBlockRef])
465465
ret phi;
466466
}
467467

468-
// FIXME we typically need only a single val and bb. With std::ptr::addr_of
469-
// and a count of 1, we should be able to avoid the overhead of creating vecs.
470-
fn AddIncomingToPhi(phi: ValueRef, vals: [ValueRef], bbs: [BasicBlockRef]) {
468+
fn AddIncomingToPhi(phi: ValueRef, val: ValueRef, bb: BasicBlockRef) {
471469
if llvm::LLVMIsUndef(phi) == lib::llvm::True { ret; }
472-
assert (vec::len::<ValueRef>(vals) == vec::len::<BasicBlockRef>(bbs));
473-
llvm::LLVMAddIncoming(phi, vec::to_ptr(vals), vec::to_ptr(bbs),
474-
vec::len(vals));
470+
let valptr = std::unsafe::reinterpret_cast(std::ptr::addr_of(val));
471+
let bbptr = std::unsafe::reinterpret_cast(std::ptr::addr_of(bb));
472+
llvm::LLVMAddIncoming(phi, valptr, bbptr, 1u);
475473
}
476474

477475
fn _UndefReturn(Fn: ValueRef) -> ValueRef {

trunk/src/comp/middle/trans_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ fn iter_vec_raw(bcx: @block_ctxt, vptrptr: ValueRef, vec_ty: ty::t,
289289
if ty::type_has_dynamic_size(bcx_tcx(bcx), unit_ty) {
290290
unit_sz
291291
} else { C_int(1) };
292-
AddIncomingToPhi(data_ptr, [InBoundsGEP(body_cx, data_ptr, [increment])],
293-
[body_cx.llbb]);
292+
AddIncomingToPhi(data_ptr, InBoundsGEP(body_cx, data_ptr, [increment]),
293+
body_cx.llbb);
294294
Br(body_cx, header_cx.llbb);
295295
ret next_cx;
296296
}

0 commit comments

Comments
 (0)