about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-04-30 17:18:59 +1000
committerZalathar <Zalathar@users.noreply.github.com>2024-05-01 09:06:53 +1000
commit52d608b5607d17baa398c45674e84b218d5aa072 (patch)
tree5adb6fe9ac1edfc89285e49936bd0cbcbaf8d10e /compiler/rustc_codegen_ssa/src/mir
parentf705de59625bb76067a5d102edc1575ff23b8845 (diff)
coverage: Eagerly do start-of-function codegen for coverage
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
-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 0064c16f5d9..cf6e2e8d14c 100644
--- a/compiler/rustc_codegen_ssa/src/mir/mod.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs
@@ -259,6 +259,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);
 
+    // If the backend supports coverage, and coverage is enabled for this function,
+    // do any necessary start-of-function codegen (e.g. locals for MC/DC bitmaps).
+    start_bx.init_coverage(instance);
+
     // 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);