Skip to content

Commit 89a7407

Browse files
huonwluqmana
authored andcommitted
librustc: clean-up expr_repeat loop generation: use native integers
1 parent 441313f commit 89a7407

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc/middle/trans/tvec.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -427,19 +427,17 @@ pub fn write_content(bcx: block,
427427

428428
let loop_counter = {
429429
// i = 0
430-
let i = alloca(loop_bcx, T_i64());
431-
Store(loop_bcx, C_i64(0), i);
430+
let i = alloca(loop_bcx, bcx.ccx().int_type);
431+
Store(loop_bcx, C_uint(bcx.ccx(), 0), i);
432432

433433
Br(loop_bcx, cond_bcx.llbb);
434434
i
435435
};
436436

437437
{ // i < count
438438
let lhs = Load(cond_bcx, loop_counter);
439-
let rhs = C_integral(T_i64(), count as u64, lib::llvm::False);
440-
let cmp_lr = ICmp(cond_bcx, lib::llvm::IntULT, lhs, rhs);
441-
let zext = ZExt(cond_bcx, cmp_lr, T_i8());
442-
let cond_val = ICmp(cond_bcx, lib::llvm::IntNE, zext, C_u8(0));
439+
let rhs = C_uint(bcx.ccx(), count);
440+
let cond_val = ICmp(cond_bcx, lib::llvm::IntULT, lhs, rhs);
443441

444442
CondBr(cond_bcx, cond_val, set_bcx.llbb, next_bcx.llbb);
445443
}
@@ -454,7 +452,7 @@ pub fn write_content(bcx: block,
454452

455453
{ // i += 1
456454
let i = Load(inc_bcx, loop_counter);
457-
let plusone = Add(inc_bcx, i, C_i64(1));
455+
let plusone = Add(inc_bcx, i, C_uint(bcx.ccx(), 1));
458456
Store(inc_bcx, plusone, loop_counter);
459457

460458
Br(inc_bcx, cond_bcx.llbb);

0 commit comments

Comments
 (0)