Use bx.switch_to_block where possible

This commit is contained in:
bjorn3 2022-02-25 15:19:52 +01:00
parent ddbbded08f
commit ff6b398f1b
3 changed files with 9 additions and 18 deletions

View File

@ -116,8 +116,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added and compare_exchange doesn't expect this, the current blocks in the
// state need to be updated.
self.block = Some(while_block);
*self.cx.current_block.borrow_mut() = Some(while_block);
self.switch_to_block(while_block);
let comparison_operator =
match operation {
@ -134,8 +133,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not expect, the current blocks in the
// state need to be updated.
self.block = Some(after_block);
*self.cx.current_block.borrow_mut() = Some(after_block);
self.switch_to_block(after_block);
return_value.to_rvalue()
}
@ -1021,8 +1019,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not expect, the current blocks in the
// state need to be updated.
self.block = Some(after_block);
*self.cx.current_block.borrow_mut() = Some(after_block);
self.switch_to_block(after_block);
variable.to_rvalue()
}

View File

@ -148,8 +148,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not expect, the current block in the
// state need to be updated.
self.block = Some(after_block);
*self.cx.current_block.borrow_mut() = Some(after_block);
self.switch_to_block(after_block);
result.to_rvalue()
}
@ -494,8 +493,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not expect, the current block in the
// state need to be updated.
self.block = Some(after_block);
*self.cx.current_block.borrow_mut() = Some(after_block);
self.switch_to_block(after_block);
result.to_rvalue()
}

View File

@ -186,8 +186,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place
// count_leading_zeroes() does not expect, the current blocks
// in the state need to be updated.
*self.current_block.borrow_mut() = Some(else_block);
self.block = Some(else_block);
self.switch_to_block(else_block);
let zeros =
match name {
@ -200,8 +199,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not
// expect, the current blocks in the state need to be updated.
*self.current_block.borrow_mut() = Some(after_block);
self.block = Some(after_block);
self.switch_to_block(after_block);
result.to_rvalue()
}
@ -1003,8 +1001,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not
// expect, the current blocks in the state need to be updated.
*self.current_block.borrow_mut() = Some(after_block);
self.block = Some(after_block);
self.switch_to_block(after_block);
res.to_rvalue()
}
@ -1074,8 +1071,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
// NOTE: since jumps were added in a place rustc does not
// expect, the current blocks in the state need to be updated.
*self.current_block.borrow_mut() = Some(after_block);
self.block = Some(after_block);
self.switch_to_block(after_block);
res.to_rvalue()
}