Skip to content

Commit 40b511a

Browse files
cixtorgraydon
authored andcommitted
Revert 106216d.
This depends on llvm's 131294.
1 parent 494c0c3 commit 40b511a

File tree

1 file changed

+14
-39
lines changed

1 file changed

+14
-39
lines changed

src/comp/middle/trans.rs

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ fn T_tydesc(&type_names tn) -> TypeRef {
457457
}
458458

459459
fn T_array(TypeRef t, uint n) -> TypeRef {
460-
assert (n != 0u);
461460
ret llvm::LLVMArrayType(t, n);
462461
}
463462

@@ -466,7 +465,7 @@ fn T_vec(TypeRef t) -> TypeRef {
466465
T_int(), // Alloc
467466
T_int(), // Fill
468467
T_int(), // Pad
469-
T_array(t, 1u) // Body elements
468+
T_array(t, 0u) // Body elements
470469
]);
471470
}
472471

@@ -568,13 +567,7 @@ fn T_tag(&type_names tn, uint size) -> TypeRef {
568567
if (tn.name_has_type(s)) {
569568
ret tn.get_type(s);
570569
}
571-
572-
auto t;
573-
if (size == 0u) {
574-
t = T_struct([T_int()]);
575-
} else {
576-
t = T_struct([T_int(), T_array(T_i8(), size)]);
577-
}
570+
auto t = T_struct([T_int(), T_array(T_i8(), size)]);
578571

579572
tn.associate(s, t);
580573
ret t;
@@ -1648,7 +1641,7 @@ fn linearize_ty_params(&@block_ctxt cx, &ty::t t) ->
16481641
fn trans_stack_local_derived_tydesc(&@block_ctxt cx, ValueRef llsz,
16491642
ValueRef llalign,
16501643
ValueRef llroottydesc,
1651-
&option::t[ValueRef] llparamtydescs)
1644+
ValueRef llparamtydescs)
16521645
-> ValueRef {
16531646
auto llmyroottydesc = alloca(cx, T_tydesc(cx.fcx.lcx.ccx.tn));
16541647

@@ -1657,19 +1650,8 @@ fn trans_stack_local_derived_tydesc(&@block_ctxt cx, ValueRef llsz,
16571650
cx.build.Store(llroottydesc, llmyroottydesc);
16581651

16591652
// Store a pointer to the rest of the descriptors.
1660-
auto llrootfirstparam = cx.build.GEP(llmyroottydesc,
1661-
[C_int(0), C_int(0)]);
1653+
auto llfirstparam = cx.build.GEP(llparamtydescs, [C_int(0), C_int(0)]);
16621654

1663-
auto llfirstparam;
1664-
alt (llparamtydescs) {
1665-
case (none[ValueRef]) {
1666-
llfirstparam = C_null(val_ty(llrootfirstparam));
1667-
}
1668-
case (some[ValueRef](?llparamtydescs)) {
1669-
llfirstparam = cx.build.GEP(llparamtydescs,
1670-
[C_int(0), C_int(0)]);
1671-
}
1672-
}
16731655
cx.build.Store(llfirstparam,
16741656
cx.build.GEP(llmyroottydesc, [C_int(0), C_int(0)]));
16751657

@@ -1739,26 +1721,19 @@ fn get_derived_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
17391721
lltydescsptr]);
17401722
v = td_val;
17411723
} else {
1742-
auto llparamtydescs_opt;
1743-
if (n_params == 0u) {
1744-
llparamtydescs_opt = none[ValueRef];
1745-
} else {
1746-
auto llparamtydescs = alloca(bcx,
1747-
T_array(T_ptr(T_tydesc(bcx.fcx.lcx.ccx.tn)), n_params));
1724+
auto llparamtydescs = alloca(bcx,
1725+
T_array(T_ptr(T_tydesc(bcx.fcx.lcx.ccx.tn)), n_params));
17481726

1749-
auto i = 0;
1750-
for (ValueRef td in tys._1) {
1751-
auto tdp = bcx.build.GEP(llparamtydescs,
1752-
[C_int(0), C_int(i)]);
1753-
bcx.build.Store(td, tdp);
1754-
i += 1;
1755-
}
1756-
1757-
llparamtydescs_opt = some[ValueRef](llparamtydescs);
1727+
auto i = 0;
1728+
for (ValueRef td in tys._1) {
1729+
auto tdp = bcx.build.GEP(llparamtydescs,
1730+
[C_int(0), C_int(i)]);
1731+
bcx.build.Store(td, tdp);
1732+
i += 1;
17581733
}
17591734

17601735
v = trans_stack_local_derived_tydesc(bcx, sz.val, align.val, root,
1761-
llparamtydescs_opt);
1736+
llparamtydescs);
17621737
}
17631738

17641739
bcx.fcx.derived_tydescs.insert(t, rec(lltydesc=v, escapes=escapes));
@@ -4539,7 +4514,7 @@ fn trans_index(&@block_ctxt cx, &ast::span sp, &@ast::expr base,
45394514
auto body = next_cx.build.GEP(v, [C_int(0), C_int(abi::vec_elt_data)]);
45404515
auto elt;
45414516
if (ty::type_has_dynamic_size(cx.fcx.lcx.ccx.tcx, unit_ty)) {
4542-
body = next_cx.build.PointerCast(body, T_ptr(T_array(T_i8(), 1u)));
4517+
body = next_cx.build.PointerCast(body, T_ptr(T_array(T_i8(), 0u)));
45434518
elt = next_cx.build.GEP(body, [C_int(0), scaled_ix]);
45444519
} else {
45454520
elt = next_cx.build.GEP(body, [C_int(0), ix_val]);

0 commit comments

Comments
 (0)