about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2022-02-18 15:10:56 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2022-02-20 13:38:15 +0100
commite6d7a8d7d406e82357f3a1675e94a3ac697e0e8e (patch)
tree2b84b325970520ca1e133abe9c27a364e86d9c88 /compiler/rustc_codegen_ssa/src
parent6d7aa4763fe7f737d6add4261b9e050b36701089 (diff)
downloadrust-e6d7a8d7d406e82357f3a1675e94a3ac697e0e8e.tar.gz
rust-e6d7a8d7d406e82357f3a1675e94a3ac697e0e8e.zip
Remove build_sibling_block
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs18
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/builder.rs3
2 files changed, 10 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index 33f883f9b6c..1979bbdb859 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -452,15 +452,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
 
         // Create the failure block and the conditional branch to it.
         let lltarget = helper.llblock(self, target);
-        let panic_block = bx.build_sibling_block("panic");
+        let panic_block = bx.append_sibling_block("panic");
         if expected {
-            bx.cond_br(cond, lltarget, panic_block.llbb());
+            bx.cond_br(cond, lltarget, panic_block);
         } else {
-            bx.cond_br(cond, panic_block.llbb(), lltarget);
+            bx.cond_br(cond, panic_block, lltarget);
         }
 
         // After this point, bx is the block for the call to panic.
-        bx = panic_block;
+        bx = Bx::build(self.cx, panic_block);
         self.set_debug_loc(&mut bx, terminator.source_info);
 
         // Get the location information.
@@ -908,10 +908,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
 
             // Test whether the function pointer is associated with the type identifier.
             let cond = bx.type_test(fn_ptr, typeid_metadata);
-            let mut bx_pass = bx.build_sibling_block("type_test.pass");
-            let mut bx_fail = bx.build_sibling_block("type_test.fail");
-            bx.cond_br(cond, bx_pass.llbb(), bx_fail.llbb());
+            let bb_pass = bx.append_sibling_block("type_test.pass");
+            let bb_fail = bx.append_sibling_block("type_test.fail");
+            bx.cond_br(cond, bb_pass, bb_fail);
 
+            let mut bx_pass = Bx::build(self.cx, bb_pass);
             helper.do_call(
                 self,
                 &mut bx_pass,
@@ -922,6 +923,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 cleanup,
             );
 
+            let mut bx_fail = Bx::build(self.cx, bb_fail);
             bx_fail.abort();
             bx_fail.unreachable();
 
@@ -1441,7 +1443,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         })
     }
 
-    // FIXME(eddyb) replace with `build_sibling_block`/`append_sibling_block`
+    // FIXME(eddyb) replace with `append_sibling_block`
     // (which requires having a `Bx` already, and not all callers do).
     fn new_block(&self, name: &str) -> Bx {
         let llbb = Bx::append_block(self.cx, self.llfn, name);
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs
index 53fb21b269a..6c7162c68d4 100644
--- a/compiler/rustc_codegen_ssa/src/traits/builder.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs
@@ -53,9 +53,6 @@ pub trait BuilderMethods<'a, 'tcx>:
 
     fn append_sibling_block(&mut self, name: &str) -> Self::BasicBlock;
 
-    // FIXME(eddyb) replace with callers using `append_sibling_block`.
-    fn build_sibling_block(&mut self, name: &str) -> Self;
-
     fn ret_void(&mut self);
     fn ret(&mut self, v: Self::Value);
     fn br(&mut self, dest: Self::BasicBlock);