Skip to content

Commit 56b7080

Browse files
committed
Remove build_sibling_block
1 parent 40d30ce commit 56b7080

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/builder.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
390390
bx
391391
}
392392

393-
fn build_sibling_block(&mut self, name: &str) -> Self {
394-
let block = self.append_sibling_block(name);
395-
Self::build(self.cx, block)
396-
}
397-
398393
fn llbb(&self) -> Block<'gcc> {
399394
self.block.expect("block")
400395
}
@@ -880,28 +875,30 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
880875
let start = dest.project_index(&mut self, zero).llval;
881876
let end = dest.project_index(&mut self, count).llval;
882877

883-
let mut header_bx = self.build_sibling_block("repeat_loop_header");
884-
let mut body_bx = self.build_sibling_block("repeat_loop_body");
885-
let next_bx = self.build_sibling_block("repeat_loop_next");
878+
let header_bb = self.append_sibling_block("repeat_loop_header");
879+
let body_bb = self.append_sibling_block("repeat_loop_body");
880+
let next_bb = self.append_sibling_block("repeat_loop_next");
886881

887882
let ptr_type = start.get_type();
888883
let current = self.llbb().get_function().new_local(None, ptr_type, "loop_var");
889884
let current_val = current.to_rvalue();
890885
self.assign(current, start);
891886

892-
self.br(header_bx.llbb());
887+
self.br(header_bb);
893888

889+
let mut header_bx = Builder::build(self.cx, header_bb);
894890
let keep_going = header_bx.icmp(IntPredicate::IntNE, current_val, end);
895-
header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb());
891+
header_bx.cond_br(keep_going, body_bb, next_bb);
896892

893+
let mut body_bx = Builder::build(self.cx, body_bb);
897894
let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
898895
cg_elem.val.store(&mut body_bx, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
899896

900897
let next = body_bx.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[self.const_usize(1)]);
901898
body_bx.llbb().add_assignment(None, current, next);
902-
body_bx.br(header_bx.llbb());
899+
body_bx.br(header_bb);
903900

904-
next_bx
901+
Builder::build(self.cx, next_bb)
905902
}
906903

907904
fn range_metadata(&mut self, _load: RValue<'gcc>, _range: WrappingRange) {

0 commit comments

Comments
 (0)