diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-02-25 15:19:52 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-02-25 15:28:56 +0100 |
| commit | ff6b398f1b8c4b09b716742d7050c6d3c1d7252f (patch) | |
| tree | a8f304a5d5d7532c45a68fdfe406a6b603c809dd | |
| parent | ddbbded08f8776943e35877ea304c0175579c146 (diff) | |
| download | rust-ff6b398f1b8c4b09b716742d7050c6d3c1d7252f.tar.gz rust-ff6b398f1b8c4b09b716742d7050c6d3c1d7252f.zip | |
Use bx.switch_to_block where possible
| -rw-r--r-- | src/builder.rs | 9 | ||||
| -rw-r--r-- | src/int.rs | 6 | ||||
| -rw-r--r-- | src/intrinsic/mod.rs | 12 |
3 files changed, 9 insertions, 18 deletions
diff --git a/src/builder.rs b/src/builder.rs index c52ab12e56b..f978ba3b7d0 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -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() } diff --git a/src/int.rs b/src/int.rs index a1f28f3f881..d2df9d2dcb6 100644 --- a/src/int.rs +++ b/src/int.rs @@ -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() } diff --git a/src/intrinsic/mod.rs b/src/intrinsic/mod.rs index 7cd0f944f2f..c91986a2b2c 100644 --- a/src/intrinsic/mod.rs +++ b/src/intrinsic/mod.rs @@ -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() } |
