Skip to content

Commit 663aa76

Browse files
committed
rustc: Call cmp glue directly if we statically know it
1 parent dfccd5a commit 663aa76

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/comp/middle/trans.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,9 +2984,17 @@ fn call_cmp_glue(&@block_ctxt cx, ValueRef lhs, ValueRef rhs, &ty::t t,
29842984
r.bcx.build.GEP(r.val,
29852985
[C_int(0), C_int(abi::tydesc_field_first_param)]);
29862986
lltydescs = r.bcx.build.Load(lltydescs);
2987-
auto llfnptr =
2988-
r.bcx.build.GEP(r.val, [C_int(0), C_int(abi::tydesc_field_cmp_glue)]);
2989-
auto llfn = r.bcx.build.Load(llfnptr);
2987+
2988+
auto llfn;
2989+
alt (ti) {
2990+
case (none) {
2991+
auto llfnptr = r.bcx.build.GEP(r.val, [C_int(0),
2992+
C_int(abi::tydesc_field_cmp_glue)]);
2993+
llfn = r.bcx.build.Load(llfnptr);
2994+
}
2995+
case (some(?sti)) { llfn = option::get(sti.cmp_glue); }
2996+
}
2997+
29902998
auto llcmpresultptr = alloca(r.bcx, T_i1());
29912999
let vec[ValueRef] llargs =
29923000
[llcmpresultptr, r.bcx.fcx.lltaskptr, C_null(T_ptr(T_nil())),

0 commit comments

Comments
 (0)