about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-11 15:43:15 +0100
committerGitHub <noreply@github.com>2023-03-11 15:43:15 +0100
commitd7372a17872a67bf136426780561bd41783dfdde (patch)
tree4a1d32f4c85c4929ccb590324605e609f7efcef2 /compiler
parent5adaa711d44d36e3ab6ed42cc4f8e68bb1a865e5 (diff)
parent871b4feba648981f7451d2c65c60771a2af19618 (diff)
downloadrust-d7372a17872a67bf136426780561bd41783dfdde.tar.gz
rust-d7372a17872a67bf136426780561bd41783dfdde.zip
Rollup merge of #108739 - 823984418:patch-1, r=cjgillot
Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time

Here, at the same time, there are two `start_llbb` builder, this should be unexpected.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs
index 2ec9fdbf44f..5cffca5230a 100644
--- a/compiler/rustc_codegen_ssa/src/mir/mod.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs
@@ -258,6 +258,10 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     // Apply debuginfo to the newly allocated locals.
     fx.debug_introduce_locals(&mut start_bx);
 
+    // The builders will be created separately for each basic block at `codegen_block`.
+    // So drop the builder of `start_llbb` to avoid having two at the same time.
+    drop(start_bx);
+
     // Codegen the body of each block using reverse postorder
     for (bb, _) in traversal::reverse_postorder(&mir) {
         fx.codegen_block(bb);