about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules2
-rw-r--r--compiler/rustc_ast/src/mut_visit.rs16
-rw-r--r--compiler/rustc_ast_passes/messages.ftl2
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs8
-rw-r--r--compiler/rustc_ast_passes/src/lib.rs3
-rw-r--r--compiler/rustc_ast_passes/src/show_span.rs68
-rw-r--r--compiler/rustc_borrowck/src/region_infer/mod.rs51
-rw-r--r--compiler/rustc_builtin_macros/messages.ftl15
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs97
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs4
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs5
-rw-r--r--compiler/rustc_hir_analysis/src/collect/type_of.rs243
-rw-r--r--compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs14
-rw-r--r--compiler/rustc_interface/src/passes.rs4
-rw-r--r--compiler/rustc_interface/src/tests.rs1
-rw-r--r--compiler/rustc_metadata/src/rmeta/table.rs3
-rw-r--r--compiler/rustc_mir_transform/src/coverage/counters.rs374
-rw-r--r--compiler/rustc_mir_transform/src/coverage/counters/tests.rs41
-rw-r--r--compiler/rustc_mir_transform/src/coverage/mod.rs10
-rw-r--r--compiler/rustc_session/src/options.rs2
-rw-r--r--library/core/src/num/nonzero.rs34
-rw-r--r--library/core/src/ptr/non_null.rs53
-rw-r--r--src/bootstrap/src/bin/main.rs20
-rw-r--r--src/bootstrap/src/bin/rustc.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs10
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs30
-rw-r--r--src/bootstrap/src/core/build_steps/format.rs6
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs40
-rw-r--r--src/bootstrap/src/core/build_steps/suggest.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs6
-rw-r--r--src/bootstrap/src/core/builder/cargo.rs2
-rw-r--r--src/bootstrap/src/core/builder/mod.rs14
-rw-r--r--src/bootstrap/src/core/config/config.rs60
-rw-r--r--src/bootstrap/src/core/config/flags.rs4
-rw-r--r--src/bootstrap/src/core/download.rs26
-rw-r--r--src/bootstrap/src/core/sanity.rs4
-rw-r--r--src/bootstrap/src/lib.rs28
-rw-r--r--src/bootstrap/src/utils/cc_detect.rs10
-rw-r--r--src/bootstrap/src/utils/helpers.rs6
-rw-r--r--src/bootstrap/src/utils/metrics.rs2
-rw-r--r--src/bootstrap/src/utils/render_tests.rs36
-rw-r--r--src/bootstrap/src/utils/tarball.rs2
-rw-r--r--src/librustdoc/formats/renderer.rs25
-rw-r--r--src/librustdoc/html/render/context.rs2
-rw-r--r--src/librustdoc/html/sources.rs50
-rw-r--r--src/librustdoc/json/mod.rs9
m---------src/llvm-project0
-rw-r--r--src/tools/compiletest/src/compute_diff.rs2
-rw-r--r--src/tools/compiletest/src/debuggers.rs6
-rw-r--r--src/tools/compiletest/src/lib.rs10
-rw-r--r--src/tools/compiletest/src/runtest.rs50
-rw-r--r--src/tools/compiletest/src/runtest/codegen_units.rs22
-rw-r--r--src/tools/compiletest/src/runtest/debuginfo.rs10
-rw-r--r--src/tools/compiletest/src/runtest/rustdoc_json.rs2
-rw-r--r--src/tools/compiletest/src/runtest/ui.rs4
-rw-r--r--src/tools/compiletest/src/util.rs2
-rw-r--r--src/tools/tidy/src/error_codes.rs6
-rw-r--r--src/tools/tidy/src/features.rs8
-rw-r--r--src/tools/tidy/src/unstable_book.rs8
-rw-r--r--src/tools/tidy/src/x_version.rs2
-rw-r--r--tests/coverage/abort.cov-map26
-rw-r--r--tests/coverage/assert.cov-map31
-rw-r--r--tests/coverage/async.cov-map27
-rw-r--r--tests/coverage/branch/guard.cov-map14
-rw-r--r--tests/coverage/branch/if.cov-map28
-rw-r--r--tests/coverage/branch/lazy-boolean.cov-map170
-rw-r--r--tests/coverage/branch/match-arms.cov-map76
-rw-r--r--tests/coverage/branch/no-mir-spans.cov-map14
-rw-r--r--tests/coverage/branch/while.cov-map43
-rw-r--r--tests/coverage/closure_macro.cov-map8
-rw-r--r--tests/coverage/closure_macro_async.cov-map8
-rw-r--r--tests/coverage/condition/conditions.cov-map73
-rw-r--r--tests/coverage/conditions.cov-map508
-rw-r--r--tests/coverage/continue.cov-map18
-rw-r--r--tests/coverage/coroutine.cov-map18
-rw-r--r--tests/coverage/inline-dead.cov-map8
-rw-r--r--tests/coverage/inline.cov-map17
-rw-r--r--tests/coverage/issue-84561.cov-map192
-rw-r--r--tests/coverage/lazy_boolean.cov-map40
-rw-r--r--tests/coverage/loops_branches.cov-map223
-rw-r--r--tests/coverage/mcdc/condition-limit.cov-map154
-rw-r--r--tests/coverage/mcdc/if.cov-map262
-rw-r--r--tests/coverage/mcdc/inlined_expressions.cov-map13
-rw-r--r--tests/coverage/mcdc/nested_if.cov-map268
-rw-r--r--tests/coverage/mcdc/non_control_flow.cov-map143
-rw-r--r--tests/coverage/nested_loops.cov-map76
-rw-r--r--tests/coverage/overflow.cov-map31
-rw-r--r--tests/coverage/panic_unwind.cov-map31
-rw-r--r--tests/coverage/simple_match.cov-map20
-rw-r--r--tests/coverage/try_error_result.cov-map242
-rw-r--r--tests/coverage/unicode.cov-map24
-rw-r--r--tests/coverage/unused.cov-map20
-rw-r--r--tests/coverage/while_early_ret.cov-map19
-rw-r--r--tests/coverage/yield.cov-map24
-rw-r--r--tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff14
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir184
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir134
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir118
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir118
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir132
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir132
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir12
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir12
-rw-r--r--tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir58
-rw-r--r--tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir58
-rw-r--r--tests/ui-fulldeps/pprust-parenthesis-insertion.rs16
-rw-r--r--tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs3
-rw-r--r--tests/ui/coroutine/coroutine-in-orphaned-anon-const.rs2
-rw-r--r--tests/ui/coroutine/coroutine-in-orphaned-anon-const.stderr10
-rw-r--r--tests/ui/deriving/deriving-coerce-pointee-neg.rs6
-rw-r--r--tests/ui/deriving/deriving-coerce-pointee-neg.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr14
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.stderr20
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs1
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr20
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr10
-rw-r--r--tests/ui/impl-trait/two_tait_defining_each_other2.rs2
-rw-r--r--tests/ui/nll/closure-requirements/thread_scope_correct_implied_bound.rs23
-rw-r--r--tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.rs21
-rw-r--r--tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.stderr17
-rw-r--r--tests/ui/nll/ty-outlives/projection-implied-bounds.rs2
-rw-r--r--tests/ui/nll/ty-outlives/projection-implied-bounds.stderr2
-rw-r--r--tests/ui/self/arbitrary-self-opaque.rs1
-rw-r--r--tests/ui/self/arbitrary-self-opaque.stderr14
-rw-r--r--tests/ui/traits/bound/unknown-assoc-with-const-arg.rs2
-rw-r--r--tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr16
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference3.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr12
145 files changed, 2798 insertions, 2982 deletions
diff --git a/.gitmodules b/.gitmodules
index 33ea0f53cf1..07fd44c2b2d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -33,7 +33,7 @@
 [submodule "src/llvm-project"]
 	path = src/llvm-project
 	url = https://github.com/rust-lang/llvm-project.git
-	branch = rustc/19.1-2024-09-17
+	branch = rustc/19.1-2024-12-03
 	shallow = true
 [submodule "src/doc/embedded-book"]
 	path = src/doc/embedded-book
diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs
index 196fcc1af30..622c260868e 100644
--- a/compiler/rustc_ast/src/mut_visit.rs
+++ b/compiler/rustc_ast/src/mut_visit.rs
@@ -1625,9 +1625,10 @@ pub fn walk_expr<T: MutVisitor>(vis: &mut T, Expr { kind, id, span, attrs, token
             visit_thin_exprs(vis, call_args);
             vis.visit_span(span);
         }
-        ExprKind::Binary(_binop, lhs, rhs) => {
+        ExprKind::Binary(binop, lhs, rhs) => {
             vis.visit_expr(lhs);
             vis.visit_expr(rhs);
+            vis.visit_span(&mut binop.span);
         }
         ExprKind::Unary(_unop, ohs) => vis.visit_expr(ohs),
         ExprKind::Cast(expr, ty) => {
@@ -1785,20 +1786,21 @@ pub fn noop_filter_map_expr<T: MutVisitor>(vis: &mut T, mut e: P<Expr>) -> Optio
 
 pub fn walk_flat_map_stmt<T: MutVisitor>(
     vis: &mut T,
-    Stmt { kind, mut span, mut id }: Stmt,
+    Stmt { kind, span, mut id }: Stmt,
 ) -> SmallVec<[Stmt; 1]> {
     vis.visit_id(&mut id);
-    let stmts: SmallVec<_> = walk_flat_map_stmt_kind(vis, kind)
+    let mut stmts: SmallVec<[Stmt; 1]> = walk_flat_map_stmt_kind(vis, kind)
         .into_iter()
         .map(|kind| Stmt { id, kind, span })
         .collect();
-    if stmts.len() > 1 {
-        panic!(
+    match stmts.len() {
+        0 => {}
+        1 => vis.visit_span(&mut stmts[0].span),
+        2.. => panic!(
             "cloning statement `NodeId`s is prohibited by default, \
              the visitor should implement custom statement visiting"
-        );
+        ),
     }
-    vis.visit_span(&mut span);
     stmts
 }
 
diff --git a/compiler/rustc_ast_passes/messages.ftl b/compiler/rustc_ast_passes/messages.ftl
index d81fd53938b..5a0ec865f9d 100644
--- a/compiler/rustc_ast_passes/messages.ftl
+++ b/compiler/rustc_ast_passes/messages.ftl
@@ -207,8 +207,6 @@ ast_passes_precise_capturing_duplicated = duplicate `use<...>` precise capturing
 
 ast_passes_precise_capturing_not_allowed_here = `use<...>` precise capturing syntax not allowed in {$loc}
 
-ast_passes_show_span = {$msg}
-
 ast_passes_stability_outside_std = stability attributes may not be used outside of the standard library
 
 ast_passes_static_without_body =
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index f65056a494b..9b600e3ee92 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -780,14 +780,6 @@ pub(crate) struct IncompatibleFeatures {
 }
 
 #[derive(Diagnostic)]
-#[diag(ast_passes_show_span)]
-pub(crate) struct ShowSpan {
-    #[primary_span]
-    pub span: Span,
-    pub msg: &'static str,
-}
-
-#[derive(Diagnostic)]
 #[diag(ast_passes_negative_bound_not_supported)]
 pub(crate) struct NegativeBoundUnsupported {
     #[primary_span]
diff --git a/compiler/rustc_ast_passes/src/lib.rs b/compiler/rustc_ast_passes/src/lib.rs
index 86752da79ae..b4ed70d83e5 100644
--- a/compiler/rustc_ast_passes/src/lib.rs
+++ b/compiler/rustc_ast_passes/src/lib.rs
@@ -1,8 +1,6 @@
 //! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
 //! parsed by `rustc_parse` and then lowered, after the passes in this crate,
 //! by `rustc_ast_lowering`.
-//!
-//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
 
 // tidy-alphabetical-start
 #![allow(internal_features)]
@@ -18,6 +16,5 @@
 pub mod ast_validation;
 mod errors;
 pub mod feature_gate;
-pub mod show_span;
 
 rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
diff --git a/compiler/rustc_ast_passes/src/show_span.rs b/compiler/rustc_ast_passes/src/show_span.rs
deleted file mode 100644
index e7ba2e7fc30..00000000000
--- a/compiler/rustc_ast_passes/src/show_span.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-//! Span debugger
-//!
-//! This module shows spans for all expressions in the crate
-//! to help with compiler debugging.
-
-use std::str::FromStr;
-
-use rustc_ast as ast;
-use rustc_ast::visit;
-use rustc_ast::visit::Visitor;
-use rustc_errors::DiagCtxtHandle;
-
-use crate::errors;
-
-enum Mode {
-    Expression,
-    Pattern,
-    Type,
-}
-
-impl FromStr for Mode {
-    type Err = ();
-    fn from_str(s: &str) -> Result<Mode, ()> {
-        let mode = match s {
-            "expr" => Mode::Expression,
-            "pat" => Mode::Pattern,
-            "ty" => Mode::Type,
-            _ => return Err(()),
-        };
-        Ok(mode)
-    }
-}
-
-struct ShowSpanVisitor<'a> {
-    dcx: DiagCtxtHandle<'a>,
-    mode: Mode,
-}
-
-impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
-    fn visit_expr(&mut self, e: &'a ast::Expr) {
-        if let Mode::Expression = self.mode {
-            self.dcx.emit_warn(errors::ShowSpan { span: e.span, msg: "expression" });
-        }
-        visit::walk_expr(self, e);
-    }
-
-    fn visit_pat(&mut self, p: &'a ast::Pat) {
-        if let Mode::Pattern = self.mode {
-            self.dcx.emit_warn(errors::ShowSpan { span: p.span, msg: "pattern" });
-        }
-        visit::walk_pat(self, p);
-    }
-
-    fn visit_ty(&mut self, t: &'a ast::Ty) {
-        if let Mode::Type = self.mode {
-            self.dcx.emit_warn(errors::ShowSpan { span: t.span, msg: "type" });
-        }
-        visit::walk_ty(self, t);
-    }
-}
-
-pub fn run(dcx: DiagCtxtHandle<'_>, mode: &str, krate: &ast::Crate) {
-    let Ok(mode) = mode.parse() else {
-        return;
-    };
-    let mut v = ShowSpanVisitor { dcx, mode };
-    visit::walk_crate(&mut v, krate);
-}
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs
index 99af5500ac6..0eecf98a6ed 100644
--- a/compiler/rustc_borrowck/src/region_infer/mod.rs
+++ b/compiler/rustc_borrowck/src/region_infer/mod.rs
@@ -973,25 +973,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
         propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>,
     ) -> bool {
         let tcx = infcx.tcx;
-
-        let TypeTest { generic_kind, lower_bound, span: _, verify_bound: _ } = type_test;
+        let TypeTest { generic_kind, lower_bound, span: blame_span, ref verify_bound } = *type_test;
 
         let generic_ty = generic_kind.to_ty(tcx);
         let Some(subject) = self.try_promote_type_test_subject(infcx, generic_ty) else {
             return false;
         };
 
-        debug!("subject = {:?}", subject);
-
-        let r_scc = self.constraint_sccs.scc(*lower_bound);
-
+        let r_scc = self.constraint_sccs.scc(lower_bound);
         debug!(
             "lower_bound = {:?} r_scc={:?} universe={:?}",
             lower_bound,
             r_scc,
             self.constraint_sccs.annotation(r_scc).min_universe()
         );
-
         // If the type test requires that `T: 'a` where `'a` is a
         // placeholder from another universe, that effectively requires
         // `T: 'static`, so we have to propagate that requirement.
@@ -1004,7 +999,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
             propagated_outlives_requirements.push(ClosureOutlivesRequirement {
                 subject,
                 outlived_free_region: static_r,
-                blame_span: type_test.span,
+                blame_span,
                 category: ConstraintCategory::Boring,
             });
 
@@ -1031,12 +1026,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
             // where `ur` is a local bound -- we are sometimes in a
             // position to prove things that our caller cannot. See
             // #53570 for an example.
-            if self.eval_verify_bound(infcx, generic_ty, ur, &type_test.verify_bound) {
+            if self.eval_verify_bound(infcx, generic_ty, ur, &verify_bound) {
                 continue;
             }
 
             let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
-            debug!("try_promote_type_test: non_local_ub={:?}", non_local_ub);
+            debug!(?non_local_ub);
 
             // This is slightly too conservative. To show T: '1, given `'2: '1`
             // and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
@@ -1049,10 +1044,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 let requirement = ClosureOutlivesRequirement {
                     subject,
                     outlived_free_region: upper_bound,
-                    blame_span: type_test.span,
+                    blame_span,
                     category: ConstraintCategory::Boring,
                 };
-                debug!("try_promote_type_test: pushing {:#?}", requirement);
+                debug!(?requirement, "adding closure requirement");
                 propagated_outlives_requirements.push(requirement);
             }
         }
@@ -1063,44 +1058,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
     /// variables in the type `T` with an equal universal region from the
     /// closure signature.
     /// This is not always possible, so this is a fallible process.
-    #[instrument(level = "debug", skip(self, infcx))]
+    #[instrument(level = "debug", skip(self, infcx), ret)]
     fn try_promote_type_test_subject(
         &self,
         infcx: &InferCtxt<'tcx>,
         ty: Ty<'tcx>,
     ) -> Option<ClosureOutlivesSubject<'tcx>> {
         let tcx = infcx.tcx;
-
-        // Opaque types' args may include useless lifetimes.
-        // We will replace them with ReStatic.
-        struct OpaqueFolder<'tcx> {
-            tcx: TyCtxt<'tcx>,
-        }
-        impl<'tcx> ty::TypeFolder<TyCtxt<'tcx>> for OpaqueFolder<'tcx> {
-            fn cx(&self) -> TyCtxt<'tcx> {
-                self.tcx
-            }
-            fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
-                use ty::TypeSuperFoldable as _;
-                let tcx = self.tcx;
-                let &ty::Alias(ty::Opaque, ty::AliasTy { args, def_id, .. }) = t.kind() else {
-                    return t.super_fold_with(self);
-                };
-                let args = std::iter::zip(args, tcx.variances_of(def_id)).map(|(arg, v)| {
-                    match (arg.unpack(), v) {
-                        (ty::GenericArgKind::Lifetime(_), ty::Bivariant) => {
-                            tcx.lifetimes.re_static.into()
-                        }
-                        _ => arg.fold_with(self),
-                    }
-                });
-                Ty::new_opaque(tcx, def_id, tcx.mk_args_from_iter(args))
-            }
-        }
-
-        let ty = ty.fold_with(&mut OpaqueFolder { tcx });
         let mut failed = false;
-
         let ty = fold_regions(tcx, ty, |r, _depth| {
             let r_vid = self.to_region_vid(r);
             let r_scc = self.constraint_sccs.scc(r_vid);
diff --git a/compiler/rustc_builtin_macros/messages.ftl b/compiler/rustc_builtin_macros/messages.ftl
index 6ebc2fd870c..c05d44cb452 100644
--- a/compiler/rustc_builtin_macros/messages.ftl
+++ b/compiler/rustc_builtin_macros/messages.ftl
@@ -94,6 +94,21 @@ builtin_macros_cfg_accessible_indeterminate = cannot determine whether the path
 builtin_macros_cfg_accessible_literal_path = `cfg_accessible` path cannot be a literal
 builtin_macros_cfg_accessible_multiple_paths = multiple `cfg_accessible` paths are specified
 builtin_macros_cfg_accessible_unspecified_path = `cfg_accessible` path is not specified
+
+builtin_macros_coerce_pointee_requires_maybe_sized = `derive(CoercePointee)` requires `{$name}` to be marked `?Sized`
+
+builtin_macros_coerce_pointee_requires_one_field = `CoercePointee` can only be derived on `struct`s with at least one field
+
+builtin_macros_coerce_pointee_requires_one_generic = `CoercePointee` can only be derived on `struct`s that are generic over at least one type
+
+builtin_macros_coerce_pointee_requires_one_pointee = exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits
+
+builtin_macros_coerce_pointee_requires_transparent = `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`
+
+builtin_macros_coerce_pointee_too_many_pointees = only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
+    .label = here another type parameter is marked as `#[pointee]`
+
+
 builtin_macros_concat_bytes_array = cannot concatenate doubly nested array
     .note = byte strings are treated as arrays of bytes
     .help = try flattening the array
diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
index 8adb9a3f4b0..3bd8f899a4a 100644
--- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs
@@ -9,6 +9,7 @@ use rustc_ast::{
 use rustc_attr as attr;
 use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
 use rustc_expand::base::{Annotatable, ExtCtxt};
+use rustc_macros::Diagnostic;
 use rustc_span::symbol::{Ident, sym};
 use rustc_span::{Span, Symbol};
 use thin_vec::{ThinVec, thin_vec};
@@ -38,12 +39,7 @@ pub(crate) fn expand_deriving_coerce_pointee(
                 .any(|r| matches!(r, attr::ReprTransparent))
         });
         if !is_transparent {
-            cx.dcx()
-                .struct_span_err(
-                    span,
-                    "`CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`",
-                )
-                .emit();
+            cx.dcx().emit_err(RequireTransparent { span });
             return;
         }
         if !matches!(
@@ -51,22 +47,12 @@ pub(crate) fn expand_deriving_coerce_pointee(
             VariantData::Struct { fields, recovered: _ } | VariantData::Tuple(fields, _)
                 if !fields.is_empty())
         {
-            cx.dcx()
-                .struct_span_err(
-                    span,
-                    "`CoercePointee` can only be derived on `struct`s with at least one field",
-                )
-                .emit();
+            cx.dcx().emit_err(RequireOneField { span });
             return;
         }
         (aitem.ident, g)
     } else {
-        cx.dcx()
-            .struct_span_err(
-                span,
-                "`CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`",
-            )
-            .emit();
+        cx.dcx().emit_err(RequireTransparent { span });
         return;
     };
 
@@ -95,10 +81,7 @@ pub(crate) fn expand_deriving_coerce_pointee(
 
     let pointee_param_idx = if type_params.is_empty() {
         // `#[derive(CoercePointee)]` requires at least one generic type on the target `struct`
-        cx.dcx().struct_span_err(
-            span,
-            "`CoercePointee` can only be derived on `struct`s that are generic over at least one type",
-        ).emit();
+        cx.dcx().emit_err(RequireOneGeneric { span });
         return;
     } else if type_params.len() == 1 {
         // Regardless of the only type param being designed as `#[pointee]` or not, we can just use it as such
@@ -111,19 +94,11 @@ pub(crate) fn expand_deriving_coerce_pointee(
         match (pointees.next(), pointees.next()) {
             (Some((idx, _span)), None) => idx,
             (None, _) => {
-                cx.dcx().struct_span_err(
-                    span,
-                    "exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits",
-                ).emit();
+                cx.dcx().emit_err(RequireOnePointee { span });
                 return;
             }
             (Some((_, one)), Some((_, another))) => {
-                cx.dcx()
-                    .struct_span_err(
-                        vec![one, another],
-                        "only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits",
-                    )
-                    .emit();
+                cx.dcx().emit_err(TooManyPointees { one, another });
                 return;
             }
         }
@@ -181,15 +156,10 @@ pub(crate) fn expand_deriving_coerce_pointee(
                 pointee_ty_ident.name,
             )
         {
-            cx.dcx()
-                .struct_span_err(
-                    pointee_ty_ident.span,
-                    format!(
-                        "`derive(CoercePointee)` requires {} to be marked `?Sized`",
-                        pointee_ty_ident.name
-                    ),
-                )
-                .emit();
+            cx.dcx().emit_err(RequiresMaybeSized {
+                span: pointee_ty_ident.span,
+                name: pointee_ty_ident.name.to_ident_string(),
+            });
             return;
         }
         let arg = GenericArg::Type(s_ty.clone());
@@ -459,3 +429,48 @@ impl<'a, 'b> rustc_ast::visit::Visitor<'a> for AlwaysErrorOnGenericParam<'a, 'b>
         }
     }
 }
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_requires_transparent)]
+struct RequireTransparent {
+    #[primary_span]
+    span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_requires_one_field)]
+struct RequireOneField {
+    #[primary_span]
+    span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_requires_one_generic)]
+struct RequireOneGeneric {
+    #[primary_span]
+    span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_requires_one_pointee)]
+struct RequireOnePointee {
+    #[primary_span]
+    span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_too_many_pointees)]
+struct TooManyPointees {
+    #[primary_span]
+    one: Span,
+    #[label]
+    another: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(builtin_macros_coerce_pointee_requires_maybe_sized)]
+struct RequiresMaybeSized {
+    #[primary_span]
+    span: Span,
+    name: String,
+}
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 5b472bb9b81..b7d64f75bf3 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -418,9 +418,7 @@ fn run_compiler(
                 return early_exit();
             }
 
-            if sess.opts.unstable_opts.parse_crate_root_only
-                || sess.opts.unstable_opts.show_span.is_some()
-            {
+            if sess.opts.unstable_opts.parse_crate_root_only {
                 return early_exit();
             }
 
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 8d5824130d8..a4636da3f62 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -309,10 +309,10 @@ impl<'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
                     self.tcx.ensure().type_of(param.def_id);
                     if let Some(default) = default {
                         // need to store default and type of default
+                        self.tcx.ensure().const_param_default(param.def_id);
                         if let hir::ConstArgKind::Anon(ac) = default.kind {
                             self.tcx.ensure().type_of(ac.def_id);
                         }
-                        self.tcx.ensure().const_param_default(param.def_id);
                     }
                 }
             }
@@ -1817,7 +1817,6 @@ fn const_param_default<'tcx>(
         ),
     };
     let icx = ItemCtxt::new(tcx, def_id);
-    // FIXME(const_generics): investigate which places do and don't need const ty feeding
-    let ct = icx.lowerer().lower_const_arg(default_ct, FeedConstTy::No);
+    let ct = icx.lowerer().lower_const_arg(default_ct, FeedConstTy::Param(def_id.to_def_id()));
     ty::EarlyBinder::bind(ct)
 }
diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs
index 7cf99bebd36..72d5b3ac4f5 100644
--- a/compiler/rustc_hir_analysis/src/collect/type_of.rs
+++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs
@@ -12,7 +12,6 @@ use rustc_middle::ty::{self, Article, IsSuggestable, Ty, TyCtxt, TypeVisitableEx
 use rustc_middle::{bug, span_bug};
 use rustc_span::symbol::Ident;
 use rustc_span::{DUMMY_SP, Span};
-use tracing::debug;
 
 use super::{ItemCtxt, bad_placeholder};
 use crate::errors::TypeofReservedKeywordUsed;
@@ -138,252 +137,26 @@ fn const_arg_anon_type_of<'tcx>(tcx: TyCtxt<'tcx>, arg_hir_id: HirId, span: Span
     use hir::*;
     use rustc_middle::ty::Ty;
 
-    let parent_node_id = tcx.parent_hir_id(arg_hir_id);
-    let parent_node = tcx.hir_node(parent_node_id);
-
-    let (generics, arg_idx) = match parent_node {
-        // Easy case: arrays repeat expressions.
+    match tcx.parent_hir_node(arg_hir_id) {
+        // Array length const arguments do not have `type_of` fed as there is never a corresponding
+        // generic parameter definition.
         Node::Ty(&hir::Ty { kind: TyKind::Array(_, ref constant), .. })
         | Node::Expr(&Expr { kind: ExprKind::Repeat(_, ref constant), .. })
             if constant.hir_id == arg_hir_id =>
         {
             return tcx.types.usize;
         }
-        Node::GenericParam(&GenericParam {
-            def_id: param_def_id,
-            kind: GenericParamKind::Const { default: Some(ct), .. },
-            ..
-        }) if ct.hir_id == arg_hir_id => {
-            return tcx
-                .type_of(param_def_id)
-                .no_bound_vars()
-                .expect("const parameter types cannot be generic");
-        }
-
-        // This match arm is for when the def_id appears in a GAT whose
-        // path can't be resolved without typechecking e.g.
-        //
-        // trait Foo {
-        //   type Assoc<const N: usize>;
-        //   fn foo() -> Self::Assoc<3>;
-        // }
-        //
-        // In the above code we would call this query with the def_id of 3 and
-        // the parent_node we match on would be the hir node for Self::Assoc<3>
-        //
-        // `Self::Assoc<3>` cant be resolved without typechecking here as we
-        // didnt write <Self as Foo>::Assoc<3>. If we did then another match
-        // arm would handle this.
-        //
-        // I believe this match arm is only needed for GAT but I am not 100% sure - BoxyUwU
-        Node::Ty(hir_ty @ hir::Ty { kind: TyKind::Path(QPath::TypeRelative(ty, segment)), .. }) => {
-            // Find the Item containing the associated type so we can create an ItemCtxt.
-            // Using the ItemCtxt lower the HIR for the unresolved assoc type into a
-            // ty which is a fully resolved projection.
-            // For the code example above, this would mean lowering `Self::Assoc<3>`
-            // to a ty::Alias(ty::Projection, `<Self as Foo>::Assoc<3>`).
-            let item_def_id = tcx.hir().get_parent_item(ty.hir_id).def_id;
-            let ty = ItemCtxt::new(tcx, item_def_id).lower_ty(hir_ty);
-
-            // Iterate through the generics of the projection to find the one that corresponds to
-            // the def_id that this query was called with. We filter to only type and const args here
-            // as a precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't
-            // but it can't hurt to be safe ^^
-            if let ty::Alias(ty::Projection | ty::Inherent, projection) = ty.kind() {
-                let generics = tcx.generics_of(projection.def_id);
-
-                let arg_index = segment
-                    .args
-                    .and_then(|args| {
-                        args.args
-                            .iter()
-                            .filter(|arg| arg.is_ty_or_const())
-                            .position(|arg| arg.hir_id() == arg_hir_id)
-                    })
-                    .unwrap_or_else(|| {
-                        bug!("no arg matching AnonConst in segment");
-                    });
-
-                (generics, arg_index)
-            } else {
-                // I dont think it's possible to reach this but I'm not 100% sure - BoxyUwU
-                return Ty::new_error_with_message(
-                    tcx,
-                    span,
-                    "unexpected non-GAT usage of an anon const",
-                );
-            }
-        }
-        Node::Expr(&Expr {
-            kind:
-                ExprKind::MethodCall(segment, ..) | ExprKind::Path(QPath::TypeRelative(_, segment)),
-            ..
-        }) => {
-            let body_owner = tcx.hir().enclosing_body_owner(arg_hir_id);
-            let tables = tcx.typeck(body_owner);
-            // This may fail in case the method/path does not actually exist.
-            // As there is no relevant param for `def_id`, we simply return
-            // `None` here.
-            let Some(type_dependent_def) = tables.type_dependent_def_id(parent_node_id) else {
-                return Ty::new_error_with_message(
-                    tcx,
-                    span,
-                    format!("unable to find type-dependent def for {parent_node_id:?}"),
-                );
-            };
-            let idx = segment
-                .args
-                .and_then(|args| {
-                    args.args
-                        .iter()
-                        .filter(|arg| arg.is_ty_or_const())
-                        .position(|arg| arg.hir_id() == arg_hir_id)
-                })
-                .unwrap_or_else(|| {
-                    bug!("no arg matching ConstArg in segment");
-                });
-
-            (tcx.generics_of(type_dependent_def), idx)
-        }
-
-        Node::Ty(&hir::Ty { kind: TyKind::Path(_), .. })
-        | Node::Expr(&Expr { kind: ExprKind::Path(_) | ExprKind::Struct(..), .. })
-        | Node::TraitRef(..)
-        | Node::Pat(_) => {
-            let path = match parent_node {
-                Node::Ty(&hir::Ty { kind: TyKind::Path(QPath::Resolved(_, path)), .. })
-                | Node::TraitRef(&TraitRef { path, .. }) => &*path,
-                Node::Expr(&Expr {
-                    kind:
-                        ExprKind::Path(QPath::Resolved(_, path))
-                        | ExprKind::Struct(&QPath::Resolved(_, path), ..),
-                    ..
-                }) => {
-                    let body_owner = tcx.hir().enclosing_body_owner(arg_hir_id);
-                    let _tables = tcx.typeck(body_owner);
-                    &*path
-                }
-                Node::Pat(pat) => {
-                    if let Some(path) = get_path_containing_arg_in_pat(pat, arg_hir_id) {
-                        path
-                    } else {
-                        return Ty::new_error_with_message(
-                            tcx,
-                            span,
-                            format!("unable to find const parent for {arg_hir_id} in pat {pat:?}"),
-                        );
-                    }
-                }
-                _ => {
-                    return Ty::new_error_with_message(
-                        tcx,
-                        span,
-                        format!("unexpected const parent path {parent_node:?}"),
-                    );
-                }
-            };
-
-            // We've encountered an `AnonConst` in some path, so we need to
-            // figure out which generic parameter it corresponds to and return
-            // the relevant type.
-            let Some((arg_index, segment)) = path.segments.iter().find_map(|seg| {
-                let args = seg.args?;
-                args.args
-                    .iter()
-                    .filter(|arg| arg.is_ty_or_const())
-                    .position(|arg| arg.hir_id() == arg_hir_id)
-                    .map(|index| (index, seg))
-                    .or_else(|| {
-                        args.constraints
-                            .iter()
-                            .copied()
-                            .filter_map(AssocItemConstraint::ct)
-                            .position(|ct| ct.hir_id == arg_hir_id)
-                            .map(|idx| (idx, seg))
-                    })
-            }) else {
-                return Ty::new_error_with_message(tcx, span, "no arg matching AnonConst in path");
-            };
-
-            let generics = match tcx.res_generics_def_id(segment.res) {
-                Some(def_id) => tcx.generics_of(def_id),
-                None => {
-                    return Ty::new_error_with_message(
-                        tcx,
-                        span,
-                        format!("unexpected anon const res {:?} in path: {:?}", segment.res, path),
-                    );
-                }
-            };
-
-            (generics, arg_index)
-        }
 
-        _ => {
-            return Ty::new_error_with_message(
-                tcx,
-                span,
-                format!("unexpected const arg parent in type_of(): {parent_node:?}"),
-            );
-        }
-    };
-
-    debug!(?parent_node);
-    debug!(?generics, ?arg_idx);
-    if let Some(param_def_id) = generics
-        .own_params
-        .iter()
-        .filter(|param| param.kind.is_ty_or_const())
-        .nth(match generics.has_self && generics.parent.is_none() {
-            true => arg_idx + 1,
-            false => arg_idx,
-        })
-        .and_then(|param| match param.kind {
-            ty::GenericParamDefKind::Const { .. } => {
-                debug!(?param);
-                Some(param.def_id)
-            }
-            _ => None,
-        })
-    {
-        tcx.type_of(param_def_id).no_bound_vars().expect("const parameter types cannot be generic")
-    } else {
-        return Ty::new_error_with_message(
+        // This is not a `bug!` as const arguments in path segments that did not resolve to anything
+        // will result in `type_of` never being fed.
+        _ => Ty::new_error_with_message(
             tcx,
             span,
-            format!("const generic parameter not found in {generics:?} at position {arg_idx:?}"),
-        );
+            "`type_of` called on const argument's anon const before the const argument was lowered",
+        ),
     }
 }
 
-fn get_path_containing_arg_in_pat<'hir>(
-    pat: &'hir hir::Pat<'hir>,
-    arg_id: HirId,
-) -> Option<&'hir hir::Path<'hir>> {
-    use hir::*;
-
-    let is_arg_in_path = |p: &hir::Path<'_>| {
-        p.segments
-            .iter()
-            .filter_map(|seg| seg.args)
-            .flat_map(|args| args.args)
-            .any(|arg| arg.hir_id() == arg_id)
-    };
-    let mut arg_path = None;
-    pat.walk(|pat| match pat.kind {
-        PatKind::Struct(QPath::Resolved(_, path), _, _)
-        | PatKind::TupleStruct(QPath::Resolved(_, path), _, _)
-        | PatKind::Path(QPath::Resolved(_, path))
-            if is_arg_in_path(path) =>
-        {
-            arg_path = Some(path);
-            false
-        }
-        _ => true,
-    });
-    arg_path
-}
-
 pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, Ty<'_>> {
     use rustc_hir::*;
     use rustc_middle::ty::Ty;
diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
index fcea0052546..66255829dcf 100644
--- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
+++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
@@ -226,13 +226,18 @@ impl TaitConstraintLocator<'_> {
             constrained = true;
 
             if !opaque_types_defined_by.contains(&self.def_id) {
-                self.tcx.dcx().emit_err(TaitForwardCompat {
+                let guar = self.tcx.dcx().emit_err(TaitForwardCompat {
                     span: hidden_type.span,
                     item_span: self
                         .tcx
                         .def_ident_span(item_def_id)
                         .unwrap_or_else(|| self.tcx.def_span(item_def_id)),
                 });
+                // Avoid "opaque type not constrained" errors on the opaque itself.
+                self.found = Some(ty::OpaqueHiddenType {
+                    span: DUMMY_SP,
+                    ty: Ty::new_error(self.tcx, guar),
+                });
             }
             let concrete_type =
                 self.tcx.erase_regions(hidden_type.remap_generic_params_to_declaration_params(
@@ -248,7 +253,7 @@ impl TaitConstraintLocator<'_> {
         if !constrained {
             debug!("no constraints in typeck results");
             if opaque_types_defined_by.contains(&self.def_id) {
-                self.tcx.dcx().emit_err(TaitForwardCompat2 {
+                let guar = self.tcx.dcx().emit_err(TaitForwardCompat2 {
                     span: self
                         .tcx
                         .def_ident_span(item_def_id)
@@ -256,6 +261,11 @@ impl TaitConstraintLocator<'_> {
                     opaque_type_span: self.tcx.def_span(self.def_id),
                     opaque_type: self.tcx.def_path_str(self.def_id),
                 });
+                // Avoid "opaque type not constrained" errors on the opaque itself.
+                self.found = Some(ty::OpaqueHiddenType {
+                    span: DUMMY_SP,
+                    ty: Ty::new_error(self.tcx, guar),
+                });
             }
             return;
         };
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 06e27ed8060..d42915f4110 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -54,10 +54,6 @@ pub(crate) fn parse<'a>(sess: &'a Session) -> Result<ast::Crate> {
         })
         .map_err(|parse_error| parse_error.emit())?;
 
-    if let Some(ref s) = sess.opts.unstable_opts.show_span {
-        rustc_ast_passes::show_span::run(sess.dcx(), s, &krate);
-    }
-
     if sess.opts.unstable_opts.input_stats {
         input_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS", "ast-stats-1");
     }
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index 9384ed925c7..3c4d9c2e928 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -844,7 +844,6 @@ fn test_unstable_options_tracking_hash() {
     tracked!(sanitizer_recover, SanitizerSet::ADDRESS);
     tracked!(saturating_float_casts, Some(true));
     tracked!(share_generics, Some(true));
-    tracked!(show_span, Some(String::from("abc")));
     tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc")));
     tracked!(small_data_threshold, Some(16));
     tracked!(split_lto_unit, Some(true));
diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs
index 9438350ca09..28f406fbc96 100644
--- a/compiler/rustc_metadata/src/rmeta/table.rs
+++ b/compiler/rustc_metadata/src/rmeta/table.rs
@@ -1,6 +1,5 @@
 use rustc_hir::def::CtorOf;
 use rustc_index::Idx;
-use tracing::trace;
 
 use crate::rmeta::*;
 
@@ -530,8 +529,6 @@ where
 {
     /// Given the metadata, extract out the value at a particular index (if any).
     pub(super) fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>(&self, metadata: M, i: I) -> T::Value<'tcx> {
-        trace!("LazyTable::lookup: index={:?} len={:?}", i, self.len);
-
         // Access past the end of the table returns a Default
         if i.index() >= self.len {
             return Default::default();
diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs
index cf9f6981c5a..46efdd16ee8 100644
--- a/compiler/rustc_mir_transform/src/coverage/counters.rs
+++ b/compiler/rustc_mir_transform/src/coverage/counters.rs
@@ -1,3 +1,4 @@
+use std::cmp::Ordering;
 use std::fmt::{self, Debug};
 
 use rustc_data_structures::captures::Captures;
@@ -10,9 +11,12 @@ use tracing::{debug, debug_span, instrument};
 
 use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, TraverseCoverageGraphWithLoops};
 
+#[cfg(test)]
+mod tests;
+
 /// The coverage counter or counter expression associated with a particular
 /// BCB node or BCB edge.
-#[derive(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
 enum BcbCounter {
     Counter { id: CounterId },
     Expression { id: ExpressionId },
@@ -43,8 +47,9 @@ struct BcbExpression {
     rhs: BcbCounter,
 }
 
-#[derive(Debug)]
-pub(super) enum CounterIncrementSite {
+/// Enum representing either a node or an edge in the coverage graph.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub(super) enum Site {
     Node { bcb: BasicCoverageBlock },
     Edge { from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock },
 }
@@ -54,16 +59,10 @@ pub(super) enum CounterIncrementSite {
 pub(super) struct CoverageCounters {
     /// List of places where a counter-increment statement should be injected
     /// into MIR, each with its corresponding counter ID.
-    counter_increment_sites: IndexVec<CounterId, CounterIncrementSite>,
+    counter_increment_sites: IndexVec<CounterId, Site>,
 
     /// Coverage counters/expressions that are associated with individual BCBs.
     node_counters: IndexVec<BasicCoverageBlock, Option<BcbCounter>>,
-    /// Coverage counters/expressions that are associated with the control-flow
-    /// edge between two BCBs.
-    ///
-    /// We currently don't iterate over this map, but if we do in the future,
-    /// switch it back to `FxIndexMap` to avoid query stability hazards.
-    edge_counters: FxHashMap<(BasicCoverageBlock, BasicCoverageBlock), BcbCounter>,
 
     /// Table of expression data, associating each expression ID with its
     /// corresponding operator (+ or -) and its LHS/RHS operands.
@@ -83,93 +82,30 @@ impl CoverageCounters {
         let mut builder = CountersBuilder::new(graph, bcb_needs_counter);
         builder.make_bcb_counters();
 
-        builder.counters
+        builder.into_coverage_counters()
     }
 
     fn with_num_bcbs(num_bcbs: usize) -> Self {
         Self {
             counter_increment_sites: IndexVec::new(),
             node_counters: IndexVec::from_elem_n(None, num_bcbs),
-            edge_counters: FxHashMap::default(),
             expressions: IndexVec::new(),
             expressions_memo: FxHashMap::default(),
         }
     }
 
-    /// Shared helper used by [`Self::make_phys_node_counter`] and
-    /// [`Self::make_phys_edge_counter`]. Don't call this directly.
-    fn make_counter_inner(&mut self, site: CounterIncrementSite) -> BcbCounter {
+    /// Creates a new physical counter for a BCB node or edge.
+    fn make_phys_counter(&mut self, site: Site) -> BcbCounter {
         let id = self.counter_increment_sites.push(site);
         BcbCounter::Counter { id }
     }
 
-    /// Creates a new physical counter for a BCB node.
-    fn make_phys_node_counter(&mut self, bcb: BasicCoverageBlock) -> BcbCounter {
-        self.make_counter_inner(CounterIncrementSite::Node { bcb })
-    }
-
-    /// Creates a new physical counter for a BCB edge.
-    fn make_phys_edge_counter(
-        &mut self,
-        from_bcb: BasicCoverageBlock,
-        to_bcb: BasicCoverageBlock,
-    ) -> BcbCounter {
-        self.make_counter_inner(CounterIncrementSite::Edge { from_bcb, to_bcb })
-    }
-
     fn make_expression(&mut self, lhs: BcbCounter, op: Op, rhs: BcbCounter) -> BcbCounter {
         let new_expr = BcbExpression { lhs, op, rhs };
-        *self
-            .expressions_memo
-            .entry(new_expr)
-            .or_insert_with(|| Self::make_expression_inner(&mut self.expressions, new_expr))
-    }
-
-    /// This is an associated function so that we can call it while borrowing
-    /// `&mut self.expressions_memo`.
-    fn make_expression_inner(
-        expressions: &mut IndexVec<ExpressionId, BcbExpression>,
-        new_expr: BcbExpression,
-    ) -> BcbCounter {
-        // Simplify expressions using basic algebra.
-        //
-        // Some of these cases might not actually occur in practice, depending
-        // on the details of how the instrumentor builds expressions.
-        let BcbExpression { lhs, op, rhs } = new_expr;
-
-        if let BcbCounter::Expression { id } = lhs {
-            let lhs_expr = &expressions[id];
-
-            // Simplify `(a - b) + b` to `a`.
-            if lhs_expr.op == Op::Subtract && op == Op::Add && lhs_expr.rhs == rhs {
-                return lhs_expr.lhs;
-            }
-            // Simplify `(a + b) - b` to `a`.
-            if lhs_expr.op == Op::Add && op == Op::Subtract && lhs_expr.rhs == rhs {
-                return lhs_expr.lhs;
-            }
-            // Simplify `(a + b) - a` to `b`.
-            if lhs_expr.op == Op::Add && op == Op::Subtract && lhs_expr.lhs == rhs {
-                return lhs_expr.rhs;
-            }
-        }
-
-        if let BcbCounter::Expression { id } = rhs {
-            let rhs_expr = &expressions[id];
-
-            // Simplify `a + (b - a)` to `b`.
-            if op == Op::Add && rhs_expr.op == Op::Subtract && lhs == rhs_expr.rhs {
-                return rhs_expr.lhs;
-            }
-            // Simplify `a - (a - b)` to `b`.
-            if op == Op::Subtract && rhs_expr.op == Op::Subtract && lhs == rhs_expr.lhs {
-                return rhs_expr.rhs;
-            }
-        }
-
-        // Simplification failed, so actually create the new expression.
-        let id = expressions.push(new_expr);
-        BcbCounter::Expression { id }
+        *self.expressions_memo.entry(new_expr).or_insert_with(|| {
+            let id = self.expressions.push(new_expr);
+            BcbCounter::Expression { id }
+        })
     }
 
     /// Creates a counter that is the sum of the given counters.
@@ -182,6 +118,12 @@ impl CoverageCounters {
             .reduce(|accum, counter| self.make_expression(accum, Op::Add, counter))
     }
 
+    /// Creates a counter whose value is `lhs - SUM(rhs)`.
+    fn make_subtracted_sum(&mut self, lhs: BcbCounter, rhs: &[BcbCounter]) -> BcbCounter {
+        let Some(rhs_sum) = self.make_sum(rhs) else { return lhs };
+        self.make_expression(lhs, Op::Subtract, rhs_sum)
+    }
+
     pub(super) fn num_counters(&self) -> usize {
         self.counter_increment_sites.len()
     }
@@ -195,20 +137,6 @@ impl CoverageCounters {
         counter
     }
 
-    fn set_edge_counter(
-        &mut self,
-        from_bcb: BasicCoverageBlock,
-        to_bcb: BasicCoverageBlock,
-        counter: BcbCounter,
-    ) -> BcbCounter {
-        let existing = self.edge_counters.insert((from_bcb, to_bcb), counter);
-        assert!(
-            existing.is_none(),
-            "edge ({from_bcb:?} -> {to_bcb:?}) already has a counter: {existing:?} => {counter:?}"
-        );
-        counter
-    }
-
     pub(super) fn term_for_bcb(&self, bcb: BasicCoverageBlock) -> Option<CovTerm> {
         self.node_counters[bcb].map(|counter| counter.as_term())
     }
@@ -218,8 +146,8 @@ impl CoverageCounters {
     /// each site's corresponding counter ID.
     pub(super) fn counter_increment_sites(
         &self,
-    ) -> impl Iterator<Item = (CounterId, &CounterIncrementSite)> {
-        self.counter_increment_sites.iter_enumerated()
+    ) -> impl Iterator<Item = (CounterId, Site)> + Captures<'_> {
+        self.counter_increment_sites.iter_enumerated().map(|(id, &site)| (id, site))
     }
 
     /// Returns an iterator over the subset of BCB nodes that have been associated
@@ -254,22 +182,53 @@ impl CoverageCounters {
     }
 }
 
+/// Symbolic representation of the coverage counter to be used for a particular
+/// node or edge in the coverage graph. The same site counter can be used for
+/// multiple sites, if they have been determined to have the same count.
+#[derive(Clone, Copy, Debug)]
+enum SiteCounter {
+    /// A physical counter at some node/edge.
+    Phys { site: Site },
+    /// A counter expression for a node that takes the sum of all its in-edge
+    /// counters.
+    NodeSumExpr { bcb: BasicCoverageBlock },
+    /// A counter expression for an edge that takes the counter of its source
+    /// node, and subtracts the counters of all its sibling out-edges.
+    EdgeDiffExpr { from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock },
+}
+
+/// Yields the graph successors of `from_bcb` that aren't `to_bcb`. This is
+/// used when creating a counter expression for [`SiteCounter::EdgeDiffExpr`].
+///
+/// For example, in this diagram the sibling out-edge targets of edge `AC` are
+/// the nodes `B` and `D`.
+///
+/// ```text
+///    A
+///  / | \
+/// B  C  D
+/// ```
+fn sibling_out_edge_targets(
+    graph: &CoverageGraph,
+    from_bcb: BasicCoverageBlock,
+    to_bcb: BasicCoverageBlock,
+) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_> {
+    graph.successors[from_bcb].iter().copied().filter(move |&t| t != to_bcb)
+}
+
 /// Helper struct that allows counter creation to inspect the BCB graph, and
 /// the set of nodes that need counters.
 struct CountersBuilder<'a> {
-    counters: CoverageCounters,
     graph: &'a CoverageGraph,
     bcb_needs_counter: &'a BitSet<BasicCoverageBlock>,
+
+    site_counters: FxHashMap<Site, SiteCounter>,
 }
 
 impl<'a> CountersBuilder<'a> {
     fn new(graph: &'a CoverageGraph, bcb_needs_counter: &'a BitSet<BasicCoverageBlock>) -> Self {
         assert_eq!(graph.num_nodes(), bcb_needs_counter.domain_size());
-        Self {
-            counters: CoverageCounters::with_num_bcbs(graph.num_nodes()),
-            graph,
-            bcb_needs_counter,
-        }
+        Self { graph, bcb_needs_counter, site_counters: FxHashMap::default() }
     }
 
     fn make_bcb_counters(&mut self) {
@@ -302,9 +261,7 @@ impl<'a> CountersBuilder<'a> {
     fn make_node_counter_and_out_edge_counters(&mut self, from_bcb: BasicCoverageBlock) {
         // First, ensure that this node has a counter of some kind.
         // We might also use that counter to compute one of the out-edge counters.
-        let node_counter = self.get_or_make_node_counter(from_bcb);
-
-        let successors = self.graph.successors[from_bcb].as_slice();
+        self.get_or_make_node_counter(from_bcb);
 
         // If this node's out-edges won't sum to the node's counter,
         // then there's no reason to create edge counters here.
@@ -315,11 +272,11 @@ impl<'a> CountersBuilder<'a> {
         // When choosing which out-edge should be given a counter expression, ignore edges that
         // already have counters, or could use the existing counter of their target node.
         let out_edge_has_counter = |to_bcb| {
-            if self.counters.edge_counters.contains_key(&(from_bcb, to_bcb)) {
+            if self.site_counters.contains_key(&Site::Edge { from_bcb, to_bcb }) {
                 return true;
             }
             self.graph.sole_predecessor(to_bcb) == Some(from_bcb)
-                && self.counters.node_counters[to_bcb].is_some()
+                && self.site_counters.contains_key(&Site::Node { bcb: to_bcb })
         };
 
         // Determine the set of out-edges that could benefit from being given an expression.
@@ -332,51 +289,41 @@ impl<'a> CountersBuilder<'a> {
 
         // If there are out-edges without counters, choose one to be given an expression
         // (computed from this node and the other out-edges) instead of a physical counter.
-        let Some(target_bcb) = self.choose_out_edge_for_expression(from_bcb, &candidate_successors)
+        let Some(to_bcb) = self.choose_out_edge_for_expression(from_bcb, &candidate_successors)
         else {
             return;
         };
 
         // For each out-edge other than the one that was chosen to get an expression,
-        // ensure that it has a counter (existing counter/expression or a new counter),
-        // and accumulate the corresponding counters into a single sum expression.
-        let other_out_edge_counters = successors
-            .iter()
-            .copied()
-            // Skip the chosen edge, since we'll calculate its count from this sum.
-            .filter(|&edge_target_bcb| edge_target_bcb != target_bcb)
-            .map(|to_bcb| self.get_or_make_edge_counter(from_bcb, to_bcb))
-            .collect::<Vec<_>>();
-        let Some(sum_of_all_other_out_edges) = self.counters.make_sum(&other_out_edge_counters)
-        else {
-            return;
-        };
+        // ensure that it has a counter (existing counter/expression or a new counter).
+        for target in sibling_out_edge_targets(self.graph, from_bcb, to_bcb) {
+            self.get_or_make_edge_counter(from_bcb, target);
+        }
 
         // Now create an expression for the chosen edge, by taking the counter
         // for its source node and subtracting the sum of its sibling out-edges.
-        let expression =
-            self.counters.make_expression(node_counter, Op::Subtract, sum_of_all_other_out_edges);
-
-        debug!("{target_bcb:?} gets an expression: {expression:?}");
-        self.counters.set_edge_counter(from_bcb, target_bcb, expression);
+        let counter = SiteCounter::EdgeDiffExpr { from_bcb, to_bcb };
+        self.site_counters.insert(Site::Edge { from_bcb, to_bcb }, counter);
     }
 
     #[instrument(level = "debug", skip(self))]
-    fn get_or_make_node_counter(&mut self, bcb: BasicCoverageBlock) -> BcbCounter {
+    fn get_or_make_node_counter(&mut self, bcb: BasicCoverageBlock) -> SiteCounter {
         // If the BCB already has a counter, return it.
-        if let Some(counter) = self.counters.node_counters[bcb] {
+        if let Some(&counter) = self.site_counters.get(&Site::Node { bcb }) {
             debug!("{bcb:?} already has a counter: {counter:?}");
             return counter;
         }
 
         let counter = self.make_node_counter_inner(bcb);
-        self.counters.set_node_counter(bcb, counter)
+        self.site_counters.insert(Site::Node { bcb }, counter);
+        counter
     }
 
-    fn make_node_counter_inner(&mut self, bcb: BasicCoverageBlock) -> BcbCounter {
+    fn make_node_counter_inner(&mut self, bcb: BasicCoverageBlock) -> SiteCounter {
         // If the node's sole in-edge already has a counter, use that.
         if let Some(sole_pred) = self.graph.sole_predecessor(bcb)
-            && let Some(&edge_counter) = self.counters.edge_counters.get(&(sole_pred, bcb))
+            && let Some(&edge_counter) =
+                self.site_counters.get(&Site::Edge { from_bcb: sole_pred, to_bcb: bcb })
         {
             return edge_counter;
         }
@@ -390,20 +337,17 @@ impl<'a> CountersBuilder<'a> {
         //   leading to infinite recursion.
         if predecessors.len() <= 1 || predecessors.contains(&bcb) {
             debug!(?bcb, ?predecessors, "node has <=1 predecessors or is its own predecessor");
-            let counter = self.counters.make_phys_node_counter(bcb);
+            let counter = SiteCounter::Phys { site: Site::Node { bcb } };
             debug!(?bcb, ?counter, "node gets a physical counter");
             return counter;
         }
 
         // A BCB with multiple incoming edges can compute its count by ensuring that counters
         // exist for each of those edges, and then adding them up to get a total count.
-        let in_edge_counters = predecessors
-            .iter()
-            .copied()
-            .map(|from_bcb| self.get_or_make_edge_counter(from_bcb, bcb))
-            .collect::<Vec<_>>();
-        let sum_of_in_edges: BcbCounter =
-            self.counters.make_sum(&in_edge_counters).expect("there must be at least one in-edge");
+        for &from_bcb in predecessors {
+            self.get_or_make_edge_counter(from_bcb, bcb);
+        }
+        let sum_of_in_edges = SiteCounter::NodeSumExpr { bcb };
 
         debug!("{bcb:?} gets a new counter (sum of predecessor counters): {sum_of_in_edges:?}");
         sum_of_in_edges
@@ -414,22 +358,23 @@ impl<'a> CountersBuilder<'a> {
         &mut self,
         from_bcb: BasicCoverageBlock,
         to_bcb: BasicCoverageBlock,
-    ) -> BcbCounter {
+    ) -> SiteCounter {
         // If the edge already has a counter, return it.
-        if let Some(&counter) = self.counters.edge_counters.get(&(from_bcb, to_bcb)) {
+        if let Some(&counter) = self.site_counters.get(&Site::Edge { from_bcb, to_bcb }) {
             debug!("Edge {from_bcb:?}->{to_bcb:?} already has a counter: {counter:?}");
             return counter;
         }
 
         let counter = self.make_edge_counter_inner(from_bcb, to_bcb);
-        self.counters.set_edge_counter(from_bcb, to_bcb, counter)
+        self.site_counters.insert(Site::Edge { from_bcb, to_bcb }, counter);
+        counter
     }
 
     fn make_edge_counter_inner(
         &mut self,
         from_bcb: BasicCoverageBlock,
         to_bcb: BasicCoverageBlock,
-    ) -> BcbCounter {
+    ) -> SiteCounter {
         // If the target node has exactly one in-edge (i.e. this one), then just
         // use the node's counter, since it will have the same value.
         if let Some(sole_pred) = self.graph.sole_predecessor(to_bcb) {
@@ -447,7 +392,7 @@ impl<'a> CountersBuilder<'a> {
         }
 
         // Make a new counter to count this edge.
-        let counter = self.counters.make_phys_edge_counter(from_bcb, to_bcb);
+        let counter = SiteCounter::Phys { site: Site::Edge { from_bcb, to_bcb } };
         debug!(?from_bcb, ?to_bcb, ?counter, "edge gets a physical counter");
         counter
     }
@@ -510,4 +455,145 @@ impl<'a> CountersBuilder<'a> {
 
         None
     }
+
+    fn into_coverage_counters(self) -> CoverageCounters {
+        Transcriber::new(&self).transcribe_counters()
+    }
+}
+
+/// Helper struct for converting `CountersBuilder` into a final `CoverageCounters`.
+struct Transcriber<'a> {
+    old: &'a CountersBuilder<'a>,
+    new: CoverageCounters,
+    phys_counter_for_site: FxHashMap<Site, BcbCounter>,
+}
+
+impl<'a> Transcriber<'a> {
+    fn new(old: &'a CountersBuilder<'a>) -> Self {
+        Self {
+            old,
+            new: CoverageCounters::with_num_bcbs(old.graph.num_nodes()),
+            phys_counter_for_site: FxHashMap::default(),
+        }
+    }
+
+    fn transcribe_counters(mut self) -> CoverageCounters {
+        for bcb in self.old.bcb_needs_counter.iter() {
+            let site = Site::Node { bcb };
+            let site_counter = self.site_counter(site);
+
+            // Resolve the site counter into flat lists of nodes/edges whose
+            // physical counts contribute to the counter for this node.
+            // Distinguish between counts that will be added vs subtracted.
+            let mut pos = vec![];
+            let mut neg = vec![];
+            self.push_resolved_sites(site_counter, &mut pos, &mut neg);
+
+            // Simplify by cancelling out sites that appear on both sides.
+            let (mut pos, mut neg) = sort_and_cancel(pos, neg);
+
+            if pos.is_empty() {
+                // If we somehow end up with no positive terms after cancellation,
+                // fall back to creating a physical counter. There's no known way
+                // for this to happen, but it's hard to confidently rule it out.
+                debug_assert!(false, "{site:?} has no positive counter terms");
+                pos = vec![Some(site)];
+                neg = vec![];
+            }
+
+            let mut new_counters_for_sites = |sites: Vec<Option<Site>>| {
+                sites
+                    .into_iter()
+                    .filter_map(|id| try { self.ensure_phys_counter(id?) })
+                    .collect::<Vec<_>>()
+            };
+            let mut pos = new_counters_for_sites(pos);
+            let mut neg = new_counters_for_sites(neg);
+
+            pos.sort();
+            neg.sort();
+
+            let pos_counter = self.new.make_sum(&pos).expect("`pos` should not be empty");
+            let new_counter = self.new.make_subtracted_sum(pos_counter, &neg);
+            self.new.set_node_counter(bcb, new_counter);
+        }
+
+        self.new
+    }
+
+    fn site_counter(&self, site: Site) -> SiteCounter {
+        self.old.site_counters.get(&site).copied().unwrap_or_else(|| {
+            // We should have already created all necessary site counters.
+            // But if we somehow didn't, avoid crashing in release builds,
+            // and just use an extra physical counter instead.
+            debug_assert!(false, "{site:?} should have a counter");
+            SiteCounter::Phys { site }
+        })
+    }
+
+    fn ensure_phys_counter(&mut self, site: Site) -> BcbCounter {
+        *self.phys_counter_for_site.entry(site).or_insert_with(|| self.new.make_phys_counter(site))
+    }
+
+    /// Resolves the given counter into flat lists of nodes/edges, whose counters
+    /// will then be added and subtracted to form a counter expression.
+    fn push_resolved_sites(&self, counter: SiteCounter, pos: &mut Vec<Site>, neg: &mut Vec<Site>) {
+        match counter {
+            SiteCounter::Phys { site } => pos.push(site),
+            SiteCounter::NodeSumExpr { bcb } => {
+                for &from_bcb in &self.old.graph.predecessors[bcb] {
+                    let edge_counter = self.site_counter(Site::Edge { from_bcb, to_bcb: bcb });
+                    self.push_resolved_sites(edge_counter, pos, neg);
+                }
+            }
+            SiteCounter::EdgeDiffExpr { from_bcb, to_bcb } => {
+                // First, add the count for `from_bcb`.
+                let node_counter = self.site_counter(Site::Node { bcb: from_bcb });
+                self.push_resolved_sites(node_counter, pos, neg);
+
+                // Then subtract the counts for the other out-edges.
+                for target in sibling_out_edge_targets(self.old.graph, from_bcb, to_bcb) {
+                    let edge_counter = self.site_counter(Site::Edge { from_bcb, to_bcb: target });
+                    // Swap `neg` and `pos` so that the counter is subtracted.
+                    self.push_resolved_sites(edge_counter, neg, pos);
+                }
+            }
+        }
+    }
+}
+
+/// Given two lists:
+/// - Sorts each list.
+/// - Converts each list to `Vec<Option<T>>`.
+/// - Scans for values that appear in both lists, and cancels them out by
+///   replacing matching pairs of values with `None`.
+fn sort_and_cancel<T: Ord>(mut pos: Vec<T>, mut neg: Vec<T>) -> (Vec<Option<T>>, Vec<Option<T>>) {
+    pos.sort();
+    neg.sort();
+
+    // Convert to `Vec<Option<T>>`. If `T` has a niche, this should be zero-cost.
+    let mut pos = pos.into_iter().map(Some).collect::<Vec<_>>();
+    let mut neg = neg.into_iter().map(Some).collect::<Vec<_>>();
+
+    // Scan through the lists using two cursors. When either cursor reaches the
+    // end of its list, there can be no more equal pairs, so stop.
+    let mut p = 0;
+    let mut n = 0;
+    while p < pos.len() && n < neg.len() {
+        // If the values are equal, remove them and advance both cursors.
+        // Otherwise, advance whichever cursor points to the lesser value.
+        // (Choosing which cursor to advance relies on both lists being sorted.)
+        match pos[p].cmp(&neg[n]) {
+            Ordering::Less => p += 1,
+            Ordering::Equal => {
+                pos[p] = None;
+                neg[n] = None;
+                p += 1;
+                n += 1;
+            }
+            Ordering::Greater => n += 1,
+        }
+    }
+
+    (pos, neg)
 }
diff --git a/compiler/rustc_mir_transform/src/coverage/counters/tests.rs b/compiler/rustc_mir_transform/src/coverage/counters/tests.rs
new file mode 100644
index 00000000000..794d4358f82
--- /dev/null
+++ b/compiler/rustc_mir_transform/src/coverage/counters/tests.rs
@@ -0,0 +1,41 @@
+use std::fmt::Debug;
+
+use super::sort_and_cancel;
+
+fn flatten<T>(input: Vec<Option<T>>) -> Vec<T> {
+    input.into_iter().flatten().collect()
+}
+
+fn sort_and_cancel_and_flatten<T: Clone + Ord>(pos: Vec<T>, neg: Vec<T>) -> (Vec<T>, Vec<T>) {
+    let (pos_actual, neg_actual) = sort_and_cancel(pos, neg);
+    (flatten(pos_actual), flatten(neg_actual))
+}
+
+#[track_caller]
+fn check_test_case<T: Clone + Debug + Ord>(
+    pos: Vec<T>,
+    neg: Vec<T>,
+    pos_expected: Vec<T>,
+    neg_expected: Vec<T>,
+) {
+    eprintln!("pos = {pos:?}; neg = {neg:?}");
+    let output = sort_and_cancel_and_flatten(pos, neg);
+    assert_eq!(output, (pos_expected, neg_expected));
+}
+
+#[test]
+fn cancellation() {
+    let cases: &[(Vec<u32>, Vec<u32>, Vec<u32>, Vec<u32>)] = &[
+        (vec![], vec![], vec![], vec![]),
+        (vec![4, 2, 1, 5, 3], vec![], vec![1, 2, 3, 4, 5], vec![]),
+        (vec![5, 5, 5, 5, 5], vec![5], vec![5, 5, 5, 5], vec![]),
+        (vec![1, 1, 2, 2, 3, 3], vec![1, 2, 3], vec![1, 2, 3], vec![]),
+        (vec![1, 1, 2, 2, 3, 3], vec![2, 4, 2], vec![1, 1, 3, 3], vec![4]),
+    ];
+
+    for (pos, neg, pos_expected, neg_expected) in cases {
+        check_test_case(pos.to_vec(), neg.to_vec(), pos_expected.to_vec(), neg_expected.to_vec());
+        // Same test case, but with its inputs flipped and its outputs flipped.
+        check_test_case(neg.to_vec(), pos.to_vec(), neg_expected.to_vec(), pos_expected.to_vec());
+    }
+}
diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs
index e8b3d80be02..241c3c79114 100644
--- a/compiler/rustc_mir_transform/src/coverage/mod.rs
+++ b/compiler/rustc_mir_transform/src/coverage/mod.rs
@@ -25,7 +25,7 @@ use rustc_span::source_map::SourceMap;
 use rustc_span::{BytePos, Pos, SourceFile, Span};
 use tracing::{debug, debug_span, trace};
 
-use crate::coverage::counters::{CounterIncrementSite, CoverageCounters};
+use crate::coverage::counters::{CoverageCounters, Site};
 use crate::coverage::graph::CoverageGraph;
 use crate::coverage::mappings::ExtractedMappings;
 
@@ -265,13 +265,13 @@ fn inject_coverage_statements<'tcx>(
     coverage_counters: &CoverageCounters,
 ) {
     // Inject counter-increment statements into MIR.
-    for (id, counter_increment_site) in coverage_counters.counter_increment_sites() {
+    for (id, site) in coverage_counters.counter_increment_sites() {
         // Determine the block to inject a counter-increment statement into.
         // For BCB nodes this is just their first block, but for edges we need
         // to create a new block between the two BCBs, and inject into that.
-        let target_bb = match *counter_increment_site {
-            CounterIncrementSite::Node { bcb } => basic_coverage_blocks[bcb].leader_bb(),
-            CounterIncrementSite::Edge { from_bcb, to_bcb } => {
+        let target_bb = match site {
+            Site::Node { bcb } => basic_coverage_blocks[bcb].leader_bb(),
+            Site::Edge { from_bcb, to_bcb } => {
                 // Create a new block between the last block of `from_bcb` and
                 // the first block of `to_bcb`.
                 let from_bb = basic_coverage_blocks[from_bcb].last_bb();
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 9e95e278325..2c0302bbb2b 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -2038,8 +2038,6 @@ written to standard error output)"),
         "make the current crate share its generic instantiations"),
     shell_argfiles: bool = (false, parse_bool, [UNTRACKED],
         "allow argument files to be specified with POSIX \"shell-style\" argument quoting"),
-    show_span: Option<String> = (None, parse_opt_string, [TRACKED],
-        "show spans in the crate root file, for compiler debugging (expr|pat|ty)"),
     simulate_remapped_rust_src_base: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
         "simulate the effect of remap-debuginfo = true at bootstrapping by remapping path \
         to rust's source base directory. only meant for testing purposes"),
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index e97af081143..a9294306b1b 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -37,6 +37,8 @@ pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {
 macro_rules! impl_zeroable_primitive {
     ($($NonZeroInner:ident ( $primitive:ty )),+ $(,)?) => {
         mod private {
+            use super::*;
+
             #[unstable(
                 feature = "nonzero_internals",
                 reason = "implementation detail which may disappear or be replaced at any time",
@@ -45,7 +47,11 @@ macro_rules! impl_zeroable_primitive {
             pub trait Sealed {}
 
             $(
-                #[derive(Debug, Clone, Copy, PartialEq)]
+                // This inner type is never shown directly, so intentionally does not have Debug
+                #[expect(missing_debug_implementations)]
+                // Since this struct is non-generic and derives Copy,
+                // the derived Clone is `*self` and thus doesn't field-project.
+                #[derive(Clone, Copy)]
                 #[repr(transparent)]
                 #[rustc_layout_scalar_valid_range_start(1)]
                 #[rustc_nonnull_optimization_guaranteed]
@@ -55,6 +61,16 @@ macro_rules! impl_zeroable_primitive {
                     issue = "none"
                 )]
                 pub struct $NonZeroInner($primitive);
+
+                // This is required to allow matching a constant.  We don't get it from a derive
+                // because the derived `PartialEq` would do a field projection, which is banned
+                // by <https://github.com/rust-lang/compiler-team/issues/807>.
+                #[unstable(
+                    feature = "nonzero_internals",
+                    reason = "implementation detail which may disappear or be replaced at any time",
+                    issue = "none"
+                )]
+                impl StructuralPartialEq for $NonZeroInner {}
             )+
         }
 
@@ -172,7 +188,7 @@ where
 {
     #[inline]
     fn clone(&self) -> Self {
-        Self(self.0)
+        *self
     }
 }
 
@@ -440,15 +456,21 @@ where
     #[rustc_const_stable(feature = "const_nonzero_get", since = "1.34.0")]
     #[inline]
     pub const fn get(self) -> T {
-        // FIXME: This can be changed to simply `self.0` once LLVM supports `!range` metadata
-        // for function arguments: https://github.com/llvm/llvm-project/issues/76628
-        //
         // Rustc can set range metadata only if it loads `self` from
         // memory somewhere. If the value of `self` was from by-value argument
         // of some not-inlined function, LLVM don't have range metadata
         // to understand that the value cannot be zero.
         //
-        // For now, using the transmute `assume`s the range at runtime.
+        // Using the transmute `assume`s the range at runtime.
+        //
+        // Even once LLVM supports `!range` metadata for function arguments
+        // (see <https://github.com/llvm/llvm-project/issues/76628>), this can't
+        // be `.0` because MCP#807 bans field-projecting into `scalar_valid_range`
+        // types, and it arguably wouldn't want to be anyway because if this is
+        // MIR-inlined, there's no opportunity to put that argument metadata anywhere.
+        //
+        // The good answer here will eventually be pattern types, which will hopefully
+        // allow it to go back to `.0`, maybe with a cast of some sort.
         //
         // SAFETY: `ZeroablePrimitive` guarantees that the size and bit validity
         // of `.0` is such that this transmute is sound.
diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index d37b7eedfcb..0ad1cad6914 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -7,7 +7,7 @@ use crate::pin::PinCoerceUnsized;
 use crate::ptr::Unique;
 use crate::slice::{self, SliceIndex};
 use crate::ub_checks::assert_unsafe_precondition;
-use crate::{fmt, hash, intrinsics, ptr};
+use crate::{fmt, hash, intrinsics, mem, ptr};
 
 /// `*mut T` but non-zero and [covariant].
 ///
@@ -69,6 +69,8 @@ use crate::{fmt, hash, intrinsics, ptr};
 #[rustc_nonnull_optimization_guaranteed]
 #[rustc_diagnostic_item = "NonNull"]
 pub struct NonNull<T: ?Sized> {
+    // Remember to use `.as_ptr()` instead of `.pointer`, as field projecting to
+    // this is banned by <https://github.com/rust-lang/compiler-team/issues/807>.
     pointer: *const T,
 }
 
@@ -282,7 +284,7 @@ impl<T: ?Sized> NonNull<T> {
     pub fn addr(self) -> NonZero<usize> {
         // SAFETY: The pointer is guaranteed by the type to be non-null,
         // meaning that the address will be non-zero.
-        unsafe { NonZero::new_unchecked(self.pointer.addr()) }
+        unsafe { NonZero::new_unchecked(self.as_ptr().addr()) }
     }
 
     /// Creates a new pointer with the given address and the [provenance][crate::ptr#provenance] of
@@ -296,7 +298,7 @@ impl<T: ?Sized> NonNull<T> {
     #[stable(feature = "strict_provenance", since = "1.84.0")]
     pub fn with_addr(self, addr: NonZero<usize>) -> Self {
         // SAFETY: The result of `ptr::from::with_addr` is non-null because `addr` is guaranteed to be non-zero.
-        unsafe { NonNull::new_unchecked(self.pointer.with_addr(addr.get()) as *mut _) }
+        unsafe { NonNull::new_unchecked(self.as_ptr().with_addr(addr.get()) as *mut _) }
     }
 
     /// Creates a new pointer by mapping `self`'s address to a new one, preserving the
@@ -335,7 +337,12 @@ impl<T: ?Sized> NonNull<T> {
     #[must_use]
     #[inline(always)]
     pub const fn as_ptr(self) -> *mut T {
-        self.pointer as *mut T
+        // This is a transmute for the same reasons as `NonZero::get`.
+
+        // SAFETY: `NonNull` is `transparent` over a `*const T`, and `*const T`
+        // and `*mut T` have the same layout, so transitively we can transmute
+        // our `NonNull` to a `*mut T` directly.
+        unsafe { mem::transmute::<Self, *mut T>(self) }
     }
 
     /// Returns a shared reference to the value. If the value may be uninitialized, [`as_uninit_ref`]
@@ -484,7 +491,7 @@ impl<T: ?Sized> NonNull<T> {
         // Additionally safety contract of `offset` guarantees that the resulting pointer is
         // pointing to an allocation, there can't be an allocation at null, thus it's safe to
         // construct `NonNull`.
-        unsafe { NonNull { pointer: intrinsics::offset(self.pointer, count) } }
+        unsafe { NonNull { pointer: intrinsics::offset(self.as_ptr(), count) } }
     }
 
     /// Calculates the offset from a pointer in bytes.
@@ -508,7 +515,7 @@ impl<T: ?Sized> NonNull<T> {
         // Additionally safety contract of `offset` guarantees that the resulting pointer is
         // pointing to an allocation, there can't be an allocation at null, thus it's safe to
         // construct `NonNull`.
-        unsafe { NonNull { pointer: self.pointer.byte_offset(count) } }
+        unsafe { NonNull { pointer: self.as_ptr().byte_offset(count) } }
     }
 
     /// Adds an offset to a pointer (convenience for `.offset(count as isize)`).
@@ -560,7 +567,7 @@ impl<T: ?Sized> NonNull<T> {
         // Additionally safety contract of `offset` guarantees that the resulting pointer is
         // pointing to an allocation, there can't be an allocation at null, thus it's safe to
         // construct `NonNull`.
-        unsafe { NonNull { pointer: intrinsics::offset(self.pointer, count) } }
+        unsafe { NonNull { pointer: intrinsics::offset(self.as_ptr(), count) } }
     }
 
     /// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
@@ -584,7 +591,7 @@ impl<T: ?Sized> NonNull<T> {
         // Additionally safety contract of `add` guarantees that the resulting pointer is pointing
         // to an allocation, there can't be an allocation at null, thus it's safe to construct
         // `NonNull`.
-        unsafe { NonNull { pointer: self.pointer.byte_add(count) } }
+        unsafe { NonNull { pointer: self.as_ptr().byte_add(count) } }
     }
 
     /// Subtracts an offset from a pointer (convenience for
@@ -666,7 +673,7 @@ impl<T: ?Sized> NonNull<T> {
         // Additionally safety contract of `sub` guarantees that the resulting pointer is pointing
         // to an allocation, there can't be an allocation at null, thus it's safe to construct
         // `NonNull`.
-        unsafe { NonNull { pointer: self.pointer.byte_sub(count) } }
+        unsafe { NonNull { pointer: self.as_ptr().byte_sub(count) } }
     }
 
     /// Calculates the distance between two pointers within the same allocation. The returned value is in
@@ -763,7 +770,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `offset_from`.
-        unsafe { self.pointer.offset_from(origin.pointer) }
+        unsafe { self.as_ptr().offset_from(origin.as_ptr()) }
     }
 
     /// Calculates the distance between two pointers within the same allocation. The returned value is in
@@ -781,7 +788,7 @@ impl<T: ?Sized> NonNull<T> {
     #[rustc_const_stable(feature = "non_null_convenience", since = "1.80.0")]
     pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: NonNull<U>) -> isize {
         // SAFETY: the caller must uphold the safety contract for `byte_offset_from`.
-        unsafe { self.pointer.byte_offset_from(origin.pointer) }
+        unsafe { self.as_ptr().byte_offset_from(origin.as_ptr()) }
     }
 
     // N.B. `wrapping_offset``, `wrapping_add`, etc are not implemented because they can wrap to null
@@ -856,7 +863,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `sub_ptr`.
-        unsafe { self.pointer.sub_ptr(subtracted.pointer) }
+        unsafe { self.as_ptr().sub_ptr(subtracted.as_ptr()) }
     }
 
     /// Calculates the distance between two pointers within the same allocation, *where it's known that
@@ -875,7 +882,7 @@ impl<T: ?Sized> NonNull<T> {
     #[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
     pub const unsafe fn byte_sub_ptr<U: ?Sized>(self, origin: NonNull<U>) -> usize {
         // SAFETY: the caller must uphold the safety contract for `byte_sub_ptr`.
-        unsafe { self.pointer.byte_sub_ptr(origin.pointer) }
+        unsafe { self.as_ptr().byte_sub_ptr(origin.as_ptr()) }
     }
 
     /// Reads the value from `self` without moving it. This leaves the
@@ -893,7 +900,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `read`.
-        unsafe { ptr::read(self.pointer) }
+        unsafe { ptr::read(self.as_ptr()) }
     }
 
     /// Performs a volatile read of the value from `self` without moving it. This
@@ -914,7 +921,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `read_volatile`.
-        unsafe { ptr::read_volatile(self.pointer) }
+        unsafe { ptr::read_volatile(self.as_ptr()) }
     }
 
     /// Reads the value from `self` without moving it. This leaves the
@@ -934,7 +941,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `read_unaligned`.
-        unsafe { ptr::read_unaligned(self.pointer) }
+        unsafe { ptr::read_unaligned(self.as_ptr()) }
     }
 
     /// Copies `count * size_of<T>` bytes from `self` to `dest`. The source
@@ -954,7 +961,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `copy`.
-        unsafe { ptr::copy(self.pointer, dest.as_ptr(), count) }
+        unsafe { ptr::copy(self.as_ptr(), dest.as_ptr(), count) }
     }
 
     /// Copies `count * size_of<T>` bytes from `self` to `dest`. The source
@@ -974,7 +981,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `copy_nonoverlapping`.
-        unsafe { ptr::copy_nonoverlapping(self.pointer, dest.as_ptr(), count) }
+        unsafe { ptr::copy_nonoverlapping(self.as_ptr(), dest.as_ptr(), count) }
     }
 
     /// Copies `count * size_of<T>` bytes from `src` to `self`. The source
@@ -994,7 +1001,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `copy`.
-        unsafe { ptr::copy(src.pointer, self.as_ptr(), count) }
+        unsafe { ptr::copy(src.as_ptr(), self.as_ptr(), count) }
     }
 
     /// Copies `count * size_of<T>` bytes from `src` to `self`. The source
@@ -1014,7 +1021,7 @@ impl<T: ?Sized> NonNull<T> {
         T: Sized,
     {
         // SAFETY: the caller must uphold the safety contract for `copy_nonoverlapping`.
-        unsafe { ptr::copy_nonoverlapping(src.pointer, self.as_ptr(), count) }
+        unsafe { ptr::copy_nonoverlapping(src.as_ptr(), self.as_ptr(), count) }
     }
 
     /// Executes the destructor (if any) of the pointed-to value.
@@ -1201,7 +1208,7 @@ impl<T: ?Sized> NonNull<T> {
 
         {
             // SAFETY: `align` has been checked to be a power of 2 above.
-            unsafe { ptr::align_offset(self.pointer, align) }
+            unsafe { ptr::align_offset(self.as_ptr(), align) }
         }
     }
 
@@ -1229,7 +1236,7 @@ impl<T: ?Sized> NonNull<T> {
     where
         T: Sized,
     {
-        self.pointer.is_aligned()
+        self.as_ptr().is_aligned()
     }
 
     /// Returns whether the pointer is aligned to `align`.
@@ -1266,7 +1273,7 @@ impl<T: ?Sized> NonNull<T> {
     #[must_use]
     #[unstable(feature = "pointer_is_aligned_to", issue = "96284")]
     pub fn is_aligned_to(self, align: usize) -> bool {
-        self.pointer.is_aligned_to(align)
+        self.as_ptr().is_aligned_to(align)
     }
 }
 
diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs
index ee813de1c9e..74dfe2e7ec8 100644
--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -48,9 +48,9 @@ fn main() {
             err => {
                 drop(err);
                 if let Ok(pid) = pid {
-                    println!("WARNING: build directory locked by process {pid}, waiting for lock");
+                    eprintln!("WARNING: build directory locked by process {pid}, waiting for lock");
                 } else {
-                    println!("WARNING: build directory locked, waiting for lock");
+                    eprintln!("WARNING: build directory locked, waiting for lock");
                 }
                 let mut lock = t!(build_lock.write());
                 t!(lock.write(process::id().to_string().as_ref()));
@@ -70,13 +70,13 @@ fn main() {
     // changelog warning, not the `x.py setup` message.
     let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
     if suggest_setup {
-        println!("WARNING: you have not made a `config.toml`");
-        println!(
+        eprintln!("WARNING: you have not made a `config.toml`");
+        eprintln!(
             "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
             `cp config.example.toml config.toml`"
         );
     } else if let Some(suggestion) = &changelog_suggestion {
-        println!("{suggestion}");
+        eprintln!("{suggestion}");
     }
 
     let pre_commit = config.src.join(".git").join("hooks").join("pre-commit");
@@ -86,13 +86,13 @@ fn main() {
     Build::new(config).build();
 
     if suggest_setup {
-        println!("WARNING: you have not made a `config.toml`");
-        println!(
+        eprintln!("WARNING: you have not made a `config.toml`");
+        eprintln!(
             "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
             `cp config.example.toml config.toml`"
         );
     } else if let Some(suggestion) = &changelog_suggestion {
-        println!("{suggestion}");
+        eprintln!("{suggestion}");
     }
 
     // Give a warning if the pre-commit script is in pre-commit and not pre-push.
@@ -102,14 +102,14 @@ fn main() {
     if fs::read_to_string(pre_commit).is_ok_and(|contents| {
         contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570")
     }) {
-        println!(
+        eprintln!(
             "WARNING: You have the pre-push script installed to .git/hooks/pre-commit. \
                   Consider moving it to .git/hooks/pre-push instead, which runs less often."
         );
     }
 
     if suggest_setup || changelog_suggestion.is_some() {
-        println!("NOTE: this message was printed twice to make it more likely to be seen");
+        eprintln!("NOTE: this message was printed twice to make it more likely to be seen");
     }
 
     if dump_bootstrap_shims {
diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs
index 88595ff7e51..e57ed488f97 100644
--- a/src/bootstrap/src/bin/rustc.rs
+++ b/src/bootstrap/src/bin/rustc.rs
@@ -306,7 +306,7 @@ fn main() {
         // should run on success, after this block.
     }
     if verbose > 0 {
-        println!("\nDid not run successfully: {status}\n{cmd:?}\n-------------");
+        eprintln!("\nDid not run successfully: {status}\n{cmd:?}\n-------------");
     }
 
     if let Some(mut on_fail) = on_fail {
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index d46c0ab7fef..2af2e83db8f 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -287,7 +287,7 @@ impl Step for CodegenBackend {
     fn run(self, builder: &Builder<'_>) {
         // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved
         if builder.build.config.vendor && self.backend == "gcc" {
-            println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled.");
+            eprintln!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled.");
             return;
         }
 
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 0cacd6e4f37..4419b11ac19 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1611,7 +1611,7 @@ impl Step for Sysroot {
         let sysroot = sysroot_dir(compiler.stage);
 
         builder
-            .verbose(|| println!("Removing sysroot {} to avoid caching bugs", sysroot.display()));
+            .verbose(|| eprintln!("Removing sysroot {} to avoid caching bugs", sysroot.display()));
         let _ = fs::remove_dir_all(&sysroot);
         t!(fs::create_dir_all(&sysroot));
 
@@ -1681,7 +1681,7 @@ impl Step for Sysroot {
                     return true;
                 }
                 if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) {
-                    builder.verbose_than(1, || println!("ignoring {}", path.display()));
+                    builder.verbose_than(1, || eprintln!("ignoring {}", path.display()));
                     false
                 } else {
                     true
@@ -2240,7 +2240,7 @@ pub fn stream_cargo(
         cargo.arg(arg);
     }
 
-    builder.verbose(|| println!("running: {cargo:?}"));
+    builder.verbose(|| eprintln!("running: {cargo:?}"));
 
     if builder.config.dry_run() {
         return true;
@@ -2261,12 +2261,12 @@ pub fn stream_cargo(
             Ok(msg) => {
                 if builder.config.json_output {
                     // Forward JSON to stdout.
-                    println!("{line}");
+                    eprintln!("{line}");
                 }
                 cb(msg)
             }
             // If this was informational, just print it out and continue
-            Err(_) => println!("{line}"),
+            Err(_) => eprintln!("{line}"),
         }
     }
 
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index a636c4a9ef1..57fce206f95 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -549,24 +549,24 @@ impl Step for DebuggerScripts {
             cp_debugger_script("natvis/liballoc.natvis");
             cp_debugger_script("natvis/libcore.natvis");
             cp_debugger_script("natvis/libstd.natvis");
-        } else {
-            cp_debugger_script("rust_types.py");
+        }
 
-            // gdb debugger scripts
-            builder.install(&builder.src.join("src/etc/rust-gdb"), &sysroot.join("bin"), 0o755);
-            builder.install(&builder.src.join("src/etc/rust-gdbgui"), &sysroot.join("bin"), 0o755);
+        cp_debugger_script("rust_types.py");
 
-            cp_debugger_script("gdb_load_rust_pretty_printers.py");
-            cp_debugger_script("gdb_lookup.py");
-            cp_debugger_script("gdb_providers.py");
+        // gdb debugger scripts
+        builder.install(&builder.src.join("src/etc/rust-gdb"), &sysroot.join("bin"), 0o755);
+        builder.install(&builder.src.join("src/etc/rust-gdbgui"), &sysroot.join("bin"), 0o755);
 
-            // lldb debugger scripts
-            builder.install(&builder.src.join("src/etc/rust-lldb"), &sysroot.join("bin"), 0o755);
+        cp_debugger_script("gdb_load_rust_pretty_printers.py");
+        cp_debugger_script("gdb_lookup.py");
+        cp_debugger_script("gdb_providers.py");
 
-            cp_debugger_script("lldb_lookup.py");
-            cp_debugger_script("lldb_providers.py");
-            cp_debugger_script("lldb_commands")
-        }
+        // lldb debugger scripts
+        builder.install(&builder.src.join("src/etc/rust-lldb"), &sysroot.join("bin"), 0o755);
+
+        cp_debugger_script("lldb_lookup.py");
+        cp_debugger_script("lldb_providers.py");
+        cp_debugger_script("lldb_commands")
     }
 }
 
@@ -2080,7 +2080,7 @@ fn maybe_install_llvm(
     {
         let mut cmd = command(llvm_config);
         cmd.arg("--libfiles");
-        builder.verbose(|| println!("running {cmd:?}"));
+        builder.verbose(|| eprintln!("running {cmd:?}"));
         let files = cmd.run_capture_stdout(builder).stdout();
         let build_llvm_out = &builder.llvm_out(builder.config.build);
         let target_llvm_out = &builder.llvm_out(target);
diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs
index 29a96f77672..d32e06d8748 100644
--- a/src/bootstrap/src/core/build_steps/format.rs
+++ b/src/bootstrap/src/core/build_steps/format.rs
@@ -107,10 +107,10 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
         if let Some(adjective) = adjective { format!("{adjective} ") } else { String::new() };
     if len <= 10 {
         for path in paths {
-            println!("fmt: {verb} {adjective}file {path}");
+            eprintln!("fmt: {verb} {adjective}file {path}");
         }
     } else {
-        println!("fmt: {verb} {len} {adjective}files");
+        eprintln!("fmt: {verb} {len} {adjective}files");
     }
 }
 
@@ -199,7 +199,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
                 match get_modified_rs_files(build) {
                     Ok(Some(files)) => {
                         if files.is_empty() {
-                            println!("fmt info: No modified files detected for formatting.");
+                            eprintln!("fmt info: No modified files detected for formatting.");
                             return;
                         }
 
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 3a8f9e48c0d..1af7b954f5e 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -134,7 +134,7 @@ impl Step for Profile {
                     t!(fs::remove_file(path));
                 }
                 _ => {
-                    println!("Exiting.");
+                    eprintln!("Exiting.");
                     crate::exit!(1);
                 }
             }
@@ -184,15 +184,15 @@ pub fn setup(config: &Config, profile: Profile) {
         Profile::Dist => &["dist", "build"],
     };
 
-    println!();
+    eprintln!();
 
-    println!("To get started, try one of the following commands:");
+    eprintln!("To get started, try one of the following commands:");
     for cmd in suggestions {
-        println!("- `x.py {cmd}`");
+        eprintln!("- `x.py {cmd}`");
     }
 
     if profile != Profile::Dist {
-        println!(
+        eprintln!(
             "For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html"
         );
     }
@@ -224,7 +224,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
     t!(fs::write(path, settings));
 
     let include_path = profile.include_path(&config.src);
-    println!("`x.py` will now use the configuration at {}", include_path.display());
+    eprintln!("`x.py` will now use the configuration at {}", include_path.display());
 }
 
 /// Creates a toolchain link for stage1 using `rustup`
@@ -256,7 +256,7 @@ impl Step for Link {
         }
 
         if !rustup_installed(builder) {
-            println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking.");
+            eprintln!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking.");
             return;
         }
 
@@ -296,7 +296,7 @@ fn attempt_toolchain_link(builder: &Builder<'_>, stage_path: &str) {
     }
 
     if try_link_toolchain(builder, stage_path) {
-        println!(
+        eprintln!(
             "Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain"
         );
     } else {
@@ -321,14 +321,14 @@ fn toolchain_is_linked(builder: &Builder<'_>) -> bool {
                 return false;
             }
             // The toolchain has already been linked.
-            println!(
+            eprintln!(
                 "`stage1` toolchain already linked; not attempting to link `stage1` toolchain"
             );
         }
         None => {
             // In this case, we don't know if the `stage1` toolchain has been linked;
             // but `rustup` failed, so let's not go any further.
-            println!(
+            eprintln!(
                 "`rustup` failed to list current toolchains; not attempting to link `stage1` toolchain"
             );
         }
@@ -389,9 +389,9 @@ pub fn interactive_path() -> io::Result<Profile> {
         input.parse()
     }
 
-    println!("Welcome to the Rust project! What do you want to do with x.py?");
+    eprintln!("Welcome to the Rust project! What do you want to do with x.py?");
     for ((letter, _), profile) in abbrev_all() {
-        println!("{}) {}: {}", letter, profile, profile.purpose());
+        eprintln!("{}) {}: {}", letter, profile, profile.purpose());
     }
     let template = loop {
         print!(
@@ -488,7 +488,7 @@ fn install_git_hook_maybe(builder: &Builder<'_>, config: &Config) -> io::Result<
         return Ok(());
     }
 
-    println!(
+    eprintln!(
         "\nRust's CI will automatically fail if it doesn't pass `tidy`, the internal tool for ensuring code quality.
 If you'd like, x.py can install a git hook for you that will automatically run `test tidy` before
 pushing your code to ensure your code is up to par. If you decide later that this behavior is
@@ -496,7 +496,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
     );
 
     if prompt_user("Would you like to install the git hook?: [y/N]")? != Some(PromptResult::Yes) {
-        println!("Ok, skipping installation!");
+        eprintln!("Ok, skipping installation!");
         return Ok(());
     }
     if !hooks_dir.exists() {
@@ -513,7 +513,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
             );
             return Err(e);
         }
-        Ok(_) => println!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"),
+        Ok(_) => eprintln!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"),
     };
     Ok(())
 }
@@ -654,7 +654,7 @@ impl Step for Editor {
                 if let Some(editor_kind) = editor_kind {
                     while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {}
                 } else {
-                    println!("Ok, skipping editor setup!");
+                    eprintln!("Ok, skipping editor setup!");
                 }
             }
             Err(e) => eprintln!("Could not determine the editor: {e}"),
@@ -687,7 +687,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu
             mismatched_settings = Some(false);
         }
     }
-    println!(
+    eprintln!(
         "\nx.py can automatically install the recommended `{settings_filename}` file for rustc development"
     );
 
@@ -706,7 +706,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu
         Some(PromptResult::Yes) => true,
         Some(PromptResult::Print) => false,
         _ => {
-            println!("Ok, skipping settings!");
+            eprintln!("Ok, skipping settings!");
             return Ok(true);
         }
     };
@@ -733,9 +733,9 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu
             _ => "Created",
         };
         fs::write(&settings_path, editor.settings_template())?;
-        println!("{verb} `{}`", settings_filename);
+        eprintln!("{verb} `{}`", settings_filename);
     } else {
-        println!("\n{}", editor.settings_template());
+        eprintln!("\n{}", editor.settings_template());
     }
     Ok(should_create)
 }
diff --git a/src/bootstrap/src/core/build_steps/suggest.rs b/src/bootstrap/src/core/build_steps/suggest.rs
index ba9b1b2fc33..7b2d9fff8f5 100644
--- a/src/bootstrap/src/core/build_steps/suggest.rs
+++ b/src/bootstrap/src/core/build_steps/suggest.rs
@@ -66,6 +66,6 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
             build.build();
         }
     } else {
-        println!("HELP: consider using the `--run` flag to automatically run suggested tests");
+        eprintln!("HELP: consider using the `--run` flag to automatically run suggested tests");
     }
 }
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 161157acffe..6da37530d96 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -471,11 +471,11 @@ impl Miri {
         // We re-use the `cargo` from above.
         cargo.arg("--print-sysroot");
 
-        builder.verbose(|| println!("running: {cargo:?}"));
+        builder.verbose(|| eprintln!("running: {cargo:?}"));
         let stdout = cargo.run_capture_stdout(builder).stdout();
         // Output is "<sysroot>\n".
         let sysroot = stdout.trim_end();
-        builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
+        builder.verbose(|| eprintln!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
         PathBuf::from(sysroot)
     }
 }
@@ -2478,7 +2478,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
         }
     }
 
-    builder.verbose(|| println!("doc tests for: {}", markdown.display()));
+    builder.verbose(|| eprintln!("doc tests for: {}", markdown.display()));
     let mut cmd = builder.rustdoc_cmd(compiler);
     builder.add_rust_test_threads(&mut cmd);
     // allow for unstable options such as new editions
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index 77f6edaabb2..38abca8b8da 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -523,7 +523,7 @@ impl Builder<'_> {
 
         let sysroot_str = sysroot.as_os_str().to_str().expect("sysroot should be UTF-8");
         if self.is_verbose() && !matches!(self.config.dry_run, DryRun::SelfCheck) {
-            println!("using sysroot {sysroot_str}");
+            eprintln!("using sysroot {sysroot_str}");
         }
 
         let mut rustflags = Rustflags::new(target);
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
index 026c26479d3..ffe3e053e72 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -392,14 +392,14 @@ impl StepDescription {
     fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
         if builder.config.skip.iter().any(|e| pathset.has(e, builder.kind)) {
             if !matches!(builder.config.dry_run, DryRun::SelfCheck) {
-                println!("Skipping {pathset:?} because it is excluded");
+                eprintln!("Skipping {pathset:?} because it is excluded");
             }
             return true;
         }
 
         if !builder.config.skip.is_empty() && !matches!(builder.config.dry_run, DryRun::SelfCheck) {
             builder.verbose(|| {
-                println!(
+                eprintln!(
                     "{:?} not skipped for {:?} -- not in {:?}",
                     pathset, self.name, builder.config.skip
                 )
@@ -1437,11 +1437,11 @@ impl<'a> Builder<'a> {
                 panic!("{}", out);
             }
             if let Some(out) = self.cache.get(&step) {
-                self.verbose_than(1, || println!("{}c {:?}", "  ".repeat(stack.len()), step));
+                self.verbose_than(1, || eprintln!("{}c {:?}", "  ".repeat(stack.len()), step));
 
                 return out;
             }
-            self.verbose_than(1, || println!("{}> {:?}", "  ".repeat(stack.len()), step));
+            self.verbose_than(1, || eprintln!("{}> {:?}", "  ".repeat(stack.len()), step));
             stack.push(Box::new(step.clone()));
         }
 
@@ -1462,7 +1462,7 @@ impl<'a> Builder<'a> {
             let step_string = format!("{step:?}");
             let brace_index = step_string.find('{').unwrap_or(0);
             let type_string = type_name::<S>();
-            println!(
+            eprintln!(
                 "[TIMING] {} {} -- {}.{:03}",
                 &type_string.strip_prefix("bootstrap::").unwrap_or(type_string),
                 &step_string[brace_index..],
@@ -1479,7 +1479,9 @@ impl<'a> Builder<'a> {
             let cur_step = stack.pop().expect("step stack empty");
             assert_eq!(cur_step.downcast_ref(), Some(&step));
         }
-        self.verbose_than(1, || println!("{}< {:?}", "  ".repeat(self.stack.borrow().len()), step));
+        self.verbose_than(1, || {
+            eprintln!("{}< {:?}", "  ".repeat(self.stack.borrow().len()), step)
+        });
         self.cache.put(step, out.clone());
         out
     }
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index b06147055f2..aa5cce2fb1b 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1293,7 +1293,7 @@ impl Config {
                     .map(|change_id| change_id.inner.map(crate::find_recent_config_change_ids))
                 {
                     if !changes.is_empty() {
-                        println!(
+                        eprintln!(
                             "WARNING: There have been changes to x.py since you last updated:\n{}",
                             crate::human_readable_changes(&changes)
                         );
@@ -1559,7 +1559,7 @@ impl Config {
         }
 
         if cargo_clippy.is_some() && rustc.is_none() {
-            println!(
+            eprintln!(
                 "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict."
             );
         }
@@ -1841,7 +1841,7 @@ impl Config {
 
             // FIXME: Remove this option at the end of 2024.
             if parallel_compiler.is_some() {
-                println!(
+                eprintln!(
                     "WARNING: The `rust.parallel-compiler` option is deprecated and does nothing. The parallel compiler (with one thread) is now the default"
                 );
             }
@@ -1873,7 +1873,7 @@ impl Config {
                         if available_backends.contains(&backend) {
                             panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'.");
                         } else {
-                            println!("HELP: '{s}' for 'rust.codegen-backends' might fail. \
+                            eprintln!("HELP: '{s}' for 'rust.codegen-backends' might fail. \
                                 Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \
                                 In this case, it would be referred to as '{backend}'.");
                         }
@@ -1902,7 +1902,7 @@ impl Config {
         // tests may fail due to using a different channel than the one used by the compiler during tests.
         if let Some(commit) = &config.download_rustc_commit {
             if is_user_configured_rust_channel {
-                println!(
+                eprintln!(
                     "WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
                 );
 
@@ -1992,10 +1992,10 @@ impl Config {
 
             if config.llvm_from_ci {
                 let warn = |option: &str| {
-                    println!(
+                    eprintln!(
                         "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build."
                     );
-                    println!(
+                    eprintln!(
                         "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false."
                     );
                 };
@@ -2014,12 +2014,12 @@ impl Config {
                 // if they've chosen a different value.
 
                 if libzstd.is_some() {
-                    println!(
+                    eprintln!(
                         "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \
                         like almost all `llvm.*` options, will be ignored and set by the LLVM CI \
                         artifacts builder config."
                     );
-                    println!(
+                    eprintln!(
                         "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false."
                     );
                 }
@@ -2088,7 +2088,7 @@ impl Config {
                             if available_backends.contains(&backend) {
                                 panic!("Invalid value '{s}' for 'target.{triple}.codegen-backends'. Instead, please use '{backend}'.");
                             } else {
-                                println!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \
+                                eprintln!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \
                                     Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \
                                     In this case, it would be referred to as '{backend}'.");
                             }
@@ -2304,7 +2304,7 @@ impl Config {
         if self.dry_run() {
             return Ok(());
         }
-        self.verbose(|| println!("running: {cmd:?}"));
+        self.verbose(|| eprintln!("running: {cmd:?}"));
         build_helper::util::try_run(cmd, self.is_verbose())
     }
 
@@ -2479,7 +2479,7 @@ impl Config {
                         // This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
                         // to not break CI. For non-CI environments, we should return an error.
                         if CiEnv::is_ci() {
-                            println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
+                            eprintln!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
                             return None;
                         } else {
                             panic!("ERROR: LLVM submodule has changes, `download-rustc` can't be used.");
@@ -2490,8 +2490,8 @@ impl Config {
                         let ci_config_toml = match self.get_builder_toml("ci-rustc") {
                             Ok(ci_config_toml) => ci_config_toml,
                             Err(e) if e.to_string().contains("unknown field") => {
-                                println!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled.");
-                                println!("HELP: Consider rebasing to a newer commit if available.");
+                                eprintln!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled.");
+                                eprintln!("HELP: Consider rebasing to a newer commit if available.");
                                 return None;
                             },
                             Err(e) => {
@@ -2516,7 +2516,7 @@ impl Config {
                             .is_some_and(|s| s == "1" || s == "true");
 
                         if disable_ci_rustc_if_incompatible && res.is_err() {
-                            println!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env.");
+                            eprintln!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env.");
                             return None;
                         }
 
@@ -2701,7 +2701,7 @@ impl Config {
             return;
         }
 
-        println!("Updating submodule {relative_path}");
+        eprintln!("Updating submodule {relative_path}");
         self.check_run(
             helpers::git(Some(&self.src))
                 .run_always()
@@ -2824,7 +2824,7 @@ impl Config {
             Some(StringOrBool::Bool(true)) => false,
             Some(StringOrBool::String(s)) if s == "if-unchanged" => {
                 if !self.rust_info.is_managed_git_subrepository() {
-                    println!(
+                    eprintln!(
                         "ERROR: `download-rustc=if-unchanged` is only compatible with Git managed sources."
                     );
                     crate::exit!(1);
@@ -2857,10 +2857,10 @@ impl Config {
                 if if_unchanged {
                     return None;
                 }
-                println!("ERROR: could not find commit hash for downloading rustc");
-                println!("HELP: maybe your repository history is too shallow?");
-                println!("HELP: consider setting `rust.download-rustc=false` in config.toml");
-                println!("HELP: or fetch enough history to include one upstream commit");
+                eprintln!("ERROR: could not find commit hash for downloading rustc");
+                eprintln!("HELP: maybe your repository history is too shallow?");
+                eprintln!("HELP: consider setting `rust.download-rustc=false` in config.toml");
+                eprintln!("HELP: or fetch enough history to include one upstream commit");
                 crate::exit!(1);
             }
         };
@@ -2899,7 +2899,7 @@ impl Config {
         let if_unchanged = || {
             if self.rust_info.is_from_tarball() {
                 // Git is needed for running "if-unchanged" logic.
-                println!(
+                eprintln!(
                     "WARNING: 'if-unchanged' has no effect on tarball sources; ignoring `download-ci-llvm`."
                 );
                 return false;
@@ -2948,10 +2948,10 @@ impl Config {
         // Only commits merged by bors will have CI artifacts.
         let commit = get_closest_merge_commit(Some(&self.src), &self.git_config(), &[]).unwrap();
         if commit.is_empty() {
-            println!("error: could not find commit hash for downloading components from CI");
-            println!("help: maybe your repository history is too shallow?");
-            println!("help: consider disabling `{option_name}`");
-            println!("help: or fetch enough history to include one upstream commit");
+            eprintln!("error: could not find commit hash for downloading components from CI");
+            eprintln!("help: maybe your repository history is too shallow?");
+            eprintln!("help: consider disabling `{option_name}`");
+            eprintln!("help: or fetch enough history to include one upstream commit");
             crate::exit!(1);
         }
 
@@ -2963,14 +2963,14 @@ impl Config {
         if has_changes {
             if if_unchanged {
                 if self.is_verbose() {
-                    println!(
+                    eprintln!(
                         "warning: saw changes to one of {modified_paths:?} since {commit}; \
                             ignoring `{option_name}`"
                     );
                 }
                 return None;
             }
-            println!(
+            eprintln!(
                 "warning: `{option_name}` is enabled, but there are changes to one of {modified_paths:?}"
             );
         }
@@ -3007,7 +3007,7 @@ pub(crate) fn check_incompatible_options_for_ci_llvm(
         ($current:expr, $expected:expr) => {
             if let Some(current) = &$current {
                 if Some(current) != $expected.as_ref() {
-                    println!(
+                    eprintln!(
                         "WARNING: `llvm.{}` has no effect with `llvm.download-ci-llvm`. \
                         Current value: {:?}, Expected value(s): {}{:?}",
                         stringify!($expected).replace("_", "-"),
@@ -3112,7 +3112,7 @@ fn check_incompatible_options_for_ci_rustc(
         ($current:expr, $expected:expr, $config_section:expr) => {
             if let Some(current) = &$current {
                 if Some(current) != $expected.as_ref() {
-                    println!(
+                    eprintln!(
                         "WARNING: `{}` has no effect with `rust.download-rustc`. \
                         Current value: {:?}, Expected value(s): {}{:?}",
                         format!("{}.{}", $config_section, stringify!($expected).replace("_", "-")),
diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs
index bfeb811508c..66b9f5ed84e 100644
--- a/src/bootstrap/src/core/config/flags.rs
+++ b/src/bootstrap/src/core/config/flags.rs
@@ -196,12 +196,12 @@ impl Flags {
         if let Ok(HelpVerboseOnly { help: true, verbose: 1.., cmd: subcommand }) =
             HelpVerboseOnly::try_parse_from(normalize_args(args))
         {
-            println!("NOTE: updating submodules before printing available paths");
+            eprintln!("NOTE: updating submodules before printing available paths");
             let config = Config::parse(Self::parse(&[String::from("build")]));
             let build = Build::new(config);
             let paths = Builder::get_help(&build, subcommand);
             if let Some(s) = paths {
-                println!("{s}");
+                eprintln!("{s}");
             } else {
                 panic!("No paths available for subcommand `{}`", subcommand.as_str());
             }
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index db35e6907e6..05b91c518cf 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -77,7 +77,7 @@ impl Config {
         if self.dry_run() && !cmd.run_always {
             return true;
         }
-        self.verbose(|| println!("running: {cmd:?}"));
+        self.verbose(|| eprintln!("running: {cmd:?}"));
         check_run(cmd, self.is_verbose())
     }
 
@@ -144,7 +144,7 @@ impl Config {
     /// Please see <https://nixos.org/patchelf.html> for more information
     fn fix_bin_or_dylib(&self, fname: &Path) {
         assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true));
-        println!("attempting to patch {}", fname.display());
+        eprintln!("attempting to patch {}", fname.display());
 
         // Only build `.nix-deps` once.
         static NIX_DEPS_DIR: OnceLock<PathBuf> = OnceLock::new();
@@ -206,7 +206,7 @@ impl Config {
     }
 
     fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) {
-        self.verbose(|| println!("download {url}"));
+        self.verbose(|| eprintln!("download {url}"));
         // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/.
         let tempfile = self.tempdir().join(dest_path.file_name().unwrap());
         // While bootstrap itself only supports http and https downloads, downstream forks might
@@ -226,7 +226,7 @@ impl Config {
     }
 
     fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) {
-        println!("downloading {url}");
+        eprintln!("downloading {url}");
         // Try curl. If that fails and we are on windows, fallback to PowerShell.
         // options should be kept in sync with
         // src/bootstrap/src/core/download.rs
@@ -341,7 +341,7 @@ impl Config {
             short_path = short_path.strip_prefix(pattern).unwrap_or(short_path);
             let dst_path = dst.join(short_path);
             self.verbose(|| {
-                println!("extracting {} to {}", original_path.display(), dst.display())
+                eprintln!("extracting {} to {}", original_path.display(), dst.display())
             });
             if !t!(member.unpack_in(dst)) {
                 panic!("path traversal attack ??");
@@ -365,7 +365,7 @@ impl Config {
     pub(crate) fn verify(&self, path: &Path, expected: &str) -> bool {
         use sha2::Digest;
 
-        self.verbose(|| println!("verifying {}", path.display()));
+        self.verbose(|| eprintln!("verifying {}", path.display()));
 
         if self.dry_run() {
             return false;
@@ -391,7 +391,7 @@ impl Config {
         let verified = checksum == expected;
 
         if !verified {
-            println!(
+            eprintln!(
                 "invalid checksum: \n\
                 found:    {checksum}\n\
                 expected: {expected}",
@@ -421,7 +421,7 @@ enum DownloadSource {
 /// Functions that are only ever called once, but named for clarify and to avoid thousand-line functions.
 impl Config {
     pub(crate) fn download_clippy(&self) -> PathBuf {
-        self.verbose(|| println!("downloading stage0 clippy artifacts"));
+        self.verbose(|| eprintln!("downloading stage0 clippy artifacts"));
 
         let date = &self.stage0_metadata.compiler.date;
         let version = &self.stage0_metadata.compiler.version;
@@ -518,7 +518,7 @@ impl Config {
     }
 
     pub(crate) fn download_ci_rustc(&self, commit: &str) {
-        self.verbose(|| println!("using downloaded stage2 artifacts from CI (commit {commit})"));
+        self.verbose(|| eprintln!("using downloaded stage2 artifacts from CI (commit {commit})"));
 
         let version = self.artifact_version_part(commit);
         // download-rustc doesn't need its own cargo, it can just use beta's. But it does need the
@@ -539,7 +539,7 @@ impl Config {
 
     #[cfg(not(feature = "bootstrap-self-test"))]
     pub(crate) fn download_beta_toolchain(&self) {
-        self.verbose(|| println!("downloading stage0 beta artifacts"));
+        self.verbose(|| eprintln!("downloading stage0 beta artifacts"));
 
         let date = &self.stage0_metadata.compiler.date;
         let version = &self.stage0_metadata.compiler.version;
@@ -677,7 +677,7 @@ impl Config {
                     return;
                 } else {
                     self.verbose(|| {
-                        println!(
+                        eprintln!(
                             "ignoring cached file {} due to failed verification",
                             tarball.display()
                         )
@@ -776,10 +776,10 @@ download-rustc = false
                     t!(check_incompatible_options_for_ci_llvm(current_config_toml, ci_config_toml));
                 }
                 Err(e) if e.to_string().contains("unknown field") => {
-                    println!(
+                    eprintln!(
                         "WARNING: CI LLVM has some fields that are no longer supported in bootstrap; download-ci-llvm will be disabled."
                     );
-                    println!("HELP: Consider rebasing to a newer commit if available.");
+                    eprintln!("HELP: Consider rebasing to a newer commit if available.");
                 }
                 Err(e) => {
                     eprintln!("ERROR: Failed to parse CI LLVM config.toml: {e}");
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index dcf68cbeeda..71e7f40f032 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -237,11 +237,11 @@ than building it.
                 stage0_supported_target_list.intersection(&missing_targets_hashset).collect();
 
             if !duplicated_targets.is_empty() {
-                println!(
+                eprintln!(
                     "Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list."
                 );
                 for duplicated_target in duplicated_targets {
-                    println!("  {duplicated_target}");
+                    eprintln!("  {duplicated_target}");
                 }
                 std::process::exit(1);
             }
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 0ecf61ffcd9..5f778223d7d 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -406,11 +406,11 @@ impl Build {
             .unwrap()
             .trim();
         if local_release.split('.').take(2).eq(version.split('.').take(2)) {
-            build.verbose(|| println!("auto-detected local-rebuild {local_release}"));
+            build.verbose(|| eprintln!("auto-detected local-rebuild {local_release}"));
             build.local_rebuild = true;
         }
 
-        build.verbose(|| println!("finding compilers"));
+        build.verbose(|| eprintln!("finding compilers"));
         utils::cc_detect::find(&build);
         // When running `setup`, the profile is about to change, so any requirements we have now may
         // be different on the next invocation. Don't check for them until the next time x.py is
@@ -418,7 +418,7 @@ impl Build {
         //
         // Similarly, for `setup` we don't actually need submodules or cargo metadata.
         if !matches!(build.config.cmd, Subcommand::Setup { .. }) {
-            build.verbose(|| println!("running sanity check"));
+            build.verbose(|| eprintln!("running sanity check"));
             crate::core::sanity::check(&mut build);
 
             // Make sure we update these before gathering metadata so we don't get an error about missing
@@ -436,7 +436,7 @@ impl Build {
             // Now, update all existing submodules.
             build.update_existing_submodules();
 
-            build.verbose(|| println!("learning about cargo"));
+            build.verbose(|| eprintln!("learning about cargo"));
             crate::core::metadata::build(&mut build);
         }
 
@@ -605,7 +605,7 @@ impl Build {
         let stamp = dir.join(".stamp");
         let mut cleared = false;
         if mtime(&stamp) < mtime(input) {
-            self.verbose(|| println!("Dirty - {}", dir.display()));
+            self.verbose(|| eprintln!("Dirty - {}", dir.display()));
             let _ = fs::remove_dir_all(dir);
             cleared = true;
         } else if stamp.exists() {
@@ -890,7 +890,7 @@ impl Build {
         let executed_at = std::panic::Location::caller();
 
         self.verbose(|| {
-            println!("running: {command:?} (created at {created_at}, executed at {executed_at})")
+            eprintln!("running: {command:?} (created at {created_at}, executed at {executed_at})")
         });
 
         let cmd = command.as_command_mut();
@@ -947,7 +947,7 @@ Executed at: {executed_at}"#,
 
         let fail = |message: &str, output: CommandOutput| -> ! {
             if self.is_verbose() {
-                println!("{message}");
+                eprintln!("{message}");
             } else {
                 let (stdout, stderr) = (output.stdout_if_present(), output.stderr_if_present());
                 // If the command captures output, the user would not see any indication that
@@ -957,16 +957,16 @@ Executed at: {executed_at}"#,
                     if let Some(stdout) =
                         output.stdout_if_present().take_if(|s| !s.trim().is_empty())
                     {
-                        println!("STDOUT:\n{stdout}\n");
+                        eprintln!("STDOUT:\n{stdout}\n");
                     }
                     if let Some(stderr) =
                         output.stderr_if_present().take_if(|s| !s.trim().is_empty())
                     {
-                        println!("STDERR:\n{stderr}\n");
+                        eprintln!("STDERR:\n{stderr}\n");
                     }
-                    println!("Command {command:?} has failed. Rerun with -v to see more details.");
+                    eprintln!("Command {command:?} has failed. Rerun with -v to see more details.");
                 } else {
-                    println!("Command has failed. Rerun with -v to see more details.");
+                    eprintln!("Command has failed. Rerun with -v to see more details.");
                 }
             }
             exit!(1);
@@ -1011,7 +1011,7 @@ Executed at: {executed_at}"#,
         match self.config.dry_run {
             DryRun::SelfCheck => (),
             DryRun::Disabled | DryRun::UserSelected => {
-                println!("{msg}");
+                eprintln!("{msg}");
             }
         }
     }
@@ -1666,7 +1666,7 @@ Executed at: {executed_at}"#,
         if self.config.dry_run() {
             return;
         }
-        self.verbose_than(1, || println!("Copy/Link {src:?} to {dst:?}"));
+        self.verbose_than(1, || eprintln!("Copy/Link {src:?} to {dst:?}"));
         if src == dst {
             return;
         }
@@ -1775,7 +1775,7 @@ Executed at: {executed_at}"#,
             return;
         }
         let dst = dstdir.join(src.file_name().unwrap());
-        self.verbose_than(1, || println!("Install {src:?} to {dst:?}"));
+        self.verbose_than(1, || eprintln!("Install {src:?} to {dst:?}"));
         t!(fs::create_dir_all(dstdir));
         if !src.exists() {
             panic!("ERROR: File \"{}\" not found!", src.display());
diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
index 0df00469452..e8d5b60948a 100644
--- a/src/bootstrap/src/utils/cc_detect.rs
+++ b/src/bootstrap/src/utils/cc_detect.rs
@@ -155,15 +155,15 @@ pub fn find_target(build: &Build, target: TargetSelection) {
         build.cxx.borrow_mut().insert(target, compiler);
     }
 
-    build.verbose(|| println!("CC_{} = {:?}", target.triple, build.cc(target)));
-    build.verbose(|| println!("CFLAGS_{} = {cflags:?}", target.triple));
+    build.verbose(|| eprintln!("CC_{} = {:?}", target.triple, build.cc(target)));
+    build.verbose(|| eprintln!("CFLAGS_{} = {cflags:?}", target.triple));
     if let Ok(cxx) = build.cxx(target) {
         let cxxflags = build.cflags(target, GitRepo::Rustc, CLang::Cxx);
-        build.verbose(|| println!("CXX_{} = {cxx:?}", target.triple));
-        build.verbose(|| println!("CXXFLAGS_{} = {cxxflags:?}", target.triple));
+        build.verbose(|| eprintln!("CXX_{} = {cxx:?}", target.triple));
+        build.verbose(|| eprintln!("CXXFLAGS_{} = {cxxflags:?}", target.triple));
     }
     if let Some(ar) = ar {
-        build.verbose(|| println!("AR_{} = {ar:?}", target.triple));
+        build.verbose(|| eprintln!("AR_{} = {ar:?}", target.triple));
         build.ar.borrow_mut().insert(target, ar);
     }
 
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index 923cc2dfc28..c0d52fd3430 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -135,7 +135,7 @@ impl Drop for TimeIt {
     fn drop(&mut self) {
         let time = self.1.elapsed();
         if !self.0 {
-            println!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis());
+            eprintln!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis());
         }
     }
 }
@@ -267,12 +267,12 @@ pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool {
     let status = match cmd.as_command_mut().status() {
         Ok(status) => status,
         Err(e) => {
-            println!("failed to execute command: {cmd:?}\nERROR: {e}");
+            eprintln!("failed to execute command: {cmd:?}\nERROR: {e}");
             return false;
         }
     };
     if !status.success() && print_cmd_on_fail {
-        println!(
+        eprintln!(
             "\n\ncommand did not execute successfully: {cmd:?}\n\
              expected success, got: {status}\n\n"
         );
diff --git a/src/bootstrap/src/utils/metrics.rs b/src/bootstrap/src/utils/metrics.rs
index 3b31fa36e88..2b393215f91 100644
--- a/src/bootstrap/src/utils/metrics.rs
+++ b/src/bootstrap/src/utils/metrics.rs
@@ -184,7 +184,7 @@ impl BuildMetrics {
                 if version.format_version == CURRENT_FORMAT_VERSION {
                     t!(serde_json::from_slice::<JsonRoot>(&contents)).invocations
                 } else {
-                    println!(
+                    eprintln!(
                         "WARNING: overriding existing build/metrics.json, as it's not \
                          compatible with build metrics format version {CURRENT_FORMAT_VERSION}."
                     );
diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs
index eb2c8254dc0..27e1c5d01b7 100644
--- a/src/bootstrap/src/utils/render_tests.rs
+++ b/src/bootstrap/src/utils/render_tests.rs
@@ -56,7 +56,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) ->
     let cmd = cmd.as_command_mut();
     cmd.stdout(Stdio::piped());
 
-    builder.verbose(|| println!("running: {cmd:?}"));
+    builder.verbose(|| eprintln!("running: {cmd:?}"));
 
     let mut process = cmd.spawn().unwrap();
 
@@ -71,7 +71,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) ->
 
     let result = process.wait_with_output().unwrap();
     if !result.status.success() && builder.is_verbose() {
-        println!(
+        eprintln!(
             "\n\ncommand did not execute successfully: {cmd:?}\n\
              expected success, got: {}",
             result.status
@@ -135,7 +135,9 @@ impl<'a> Renderer<'a> {
         if self.up_to_date_tests > 0 {
             let n = self.up_to_date_tests;
             let s = if n > 1 { "s" } else { "" };
-            println!("help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n");
+            eprintln!(
+                "help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n"
+            );
         }
     }
 
@@ -190,7 +192,7 @@ impl<'a> Renderer<'a> {
         if let Some(exec_time) = test.exec_time {
             print!(" ({exec_time:.2?})");
         }
-        println!();
+        eprintln!();
     }
 
     fn render_test_outcome_terse(&mut self, outcome: Outcome<'_>, test: &TestOutcome) {
@@ -200,7 +202,7 @@ impl<'a> Renderer<'a> {
                 let executed = format!("{:>width$}", self.executed_tests - 1, width = total.len());
                 print!(" {executed}/{total}");
             }
-            println!();
+            eprintln!();
             self.terse_tests_in_line = 0;
         }
 
@@ -212,31 +214,31 @@ impl<'a> Renderer<'a> {
     fn render_suite_outcome(&self, outcome: Outcome<'_>, suite: &SuiteOutcome) {
         // The terse output doesn't end with a newline, so we need to add it ourselves.
         if !self.builder.config.verbose_tests {
-            println!();
+            eprintln!();
         }
 
         if !self.failures.is_empty() {
-            println!("\nfailures:\n");
+            eprintln!("\nfailures:\n");
             for failure in &self.failures {
                 if failure.stdout.is_some() || failure.message.is_some() {
-                    println!("---- {} stdout ----", failure.name);
+                    eprintln!("---- {} stdout ----", failure.name);
                     if let Some(stdout) = &failure.stdout {
-                        println!("{stdout}");
+                        eprintln!("{stdout}");
                     }
                     if let Some(message) = &failure.message {
-                        println!("NOTE: {message}");
+                        eprintln!("NOTE: {message}");
                     }
                 }
             }
 
-            println!("\nfailures:");
+            eprintln!("\nfailures:");
             for failure in &self.failures {
-                println!("    {}", failure.name);
+                eprintln!("    {}", failure.name);
             }
         }
 
         if !self.benches.is_empty() {
-            println!("\nbenchmarks:");
+            eprintln!("\nbenchmarks:");
 
             let mut rows = Vec::new();
             for bench in &self.benches {
@@ -251,13 +253,13 @@ impl<'a> Renderer<'a> {
             let max_1 = rows.iter().map(|r| r.1.len()).max().unwrap_or(0);
             let max_2 = rows.iter().map(|r| r.2.len()).max().unwrap_or(0);
             for row in &rows {
-                println!("    {:<max_0$} {:>max_1$} {:>max_2$}", row.0, row.1, row.2);
+                eprintln!("    {:<max_0$} {:>max_1$} {:>max_2$}", row.0, row.1, row.2);
             }
         }
 
         print!("\ntest result: ");
         self.builder.colored_stdout(|stdout| outcome.write_long(stdout)).unwrap();
-        println!(
+        eprintln!(
             ". {} passed; {} failed; {} ignored; {} measured; {} filtered out{time}\n",
             suite.passed,
             suite.failed,
@@ -274,7 +276,7 @@ impl<'a> Renderer<'a> {
     fn render_message(&mut self, message: Message) {
         match message {
             Message::Suite(SuiteMessage::Started { test_count }) => {
-                println!("\nrunning {test_count} tests");
+                eprintln!("\nrunning {test_count} tests");
                 self.executed_tests = 0;
                 self.terse_tests_in_line = 0;
                 self.tests_count = Some(test_count);
@@ -314,7 +316,7 @@ impl<'a> Renderer<'a> {
                 self.failures.push(outcome);
             }
             Message::Test(TestMessage::Timeout { name }) => {
-                println!("test {name} has been running for a long time");
+                eprintln!("test {name} has been running for a long time");
             }
             Message::Test(TestMessage::Started) => {} // Not useful
         }
diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs
index 3c6c7a7fa18..f60498a4872 100644
--- a/src/bootstrap/src/utils/tarball.rs
+++ b/src/bootstrap/src/utils/tarball.rs
@@ -344,7 +344,7 @@ impl<'a> Tarball<'a> {
         // For `x install` tarball files aren't needed, so we can speed up the process by not producing them.
         let compression_profile = if self.builder.kind == Kind::Install {
             self.builder.verbose(|| {
-                println!("Forcing dist.compression-profile = 'no-op' for `x install`.")
+                eprintln!("Forcing dist.compression-profile = 'no-op' for `x install`.")
             });
             // "no-op" indicates that the rust-installer won't produce compressed tarball sources.
             "no-op"
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 582ef7d2c48..5e4e6f27a15 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -17,17 +17,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
     ///
     /// This is true for html, and false for json. See #80664
     const RUN_ON_MODULE: bool;
+
     /// This associated type is the type where the current module information is stored.
     ///
     /// For each module, we go through their items by calling for each item:
     ///
-    /// 1. save_module_data
-    /// 2. item
-    /// 3. set_back_info
+    /// 1. `save_module_data`
+    /// 2. `item`
+    /// 3. `restore_module_data`
     ///
-    /// However,the `item` method might update information in `self` (for example if the child is
-    /// a module). To prevent it to impact the other children of the current module, we need to
-    /// reset the information between each call to `item` by using `set_back_info`.
+    /// This is because the `item` method might update information in `self` (for example if the child
+    /// is a module). To prevent it from impacting the other children of the current module, we need to
+    /// reset the information between each call to `item` by using `restore_module_data`.
     type ModuleData;
 
     /// Sets up any state required for the renderer. When this is called the cache has already been
@@ -41,18 +42,18 @@ pub(crate) trait FormatRenderer<'tcx>: Sized {
 
     /// This method is called right before call [`Self::item`]. This method returns a type
     /// containing information that needs to be reset after the [`Self::item`] method has been
-    /// called with the [`Self::set_back_info`] method.
+    /// called with the [`Self::restore_module_data`] method.
     ///
     /// In short it goes like this:
     ///
     /// ```ignore (not valid code)
-    /// let reset_data = type.save_module_data();
-    /// type.item(item)?;
-    /// type.set_back_info(reset_data);
+    /// let reset_data = renderer.save_module_data();
+    /// renderer.item(item)?;
+    /// renderer.restore_module_data(reset_data);
     /// ```
     fn save_module_data(&mut self) -> Self::ModuleData;
     /// Used to reset current module's information.
-    fn set_back_info(&mut self, info: Self::ModuleData);
+    fn restore_module_data(&mut self, info: Self::ModuleData);
 
     /// Renders a single non-module item. This means no recursive sub-item rendering is required.
     fn item(&mut self, item: clean::Item) -> Result<(), Error>;
@@ -91,7 +92,7 @@ fn run_format_inner<'tcx, T: FormatRenderer<'tcx>>(
         for it in module.items {
             let info = cx.save_module_data();
             run_format_inner(cx, it, prof)?;
-            cx.set_back_info(info);
+            cx.restore_module_data(info);
         }
 
         cx.mod_item_out()?;
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 40468aef4db..2d5df75e7dc 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -601,7 +601,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
         self.info
     }
 
-    fn set_back_info(&mut self, info: Self::ModuleData) {
+    fn restore_module_data(&mut self, info: Self::ModuleData) {
         self.info = info;
     }
 
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index c37506e3588..9827f97d28d 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -9,7 +9,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
 use rustc_hir::def_id::LOCAL_CRATE;
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
-use rustc_span::{FileName, sym};
+use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, sym};
 use tracing::info;
 
 use crate::clean;
@@ -50,8 +50,14 @@ struct LocalSourcesCollector<'a, 'tcx> {
     src_root: &'a Path,
 }
 
-fn is_real_and_local(span: clean::Span, sess: &Session) -> bool {
-    span.cnum(sess) == LOCAL_CRATE && span.filename(sess).is_real()
+fn filename_real_and_local(span: clean::Span, sess: &Session) -> Option<RealFileName> {
+    if span.cnum(sess) == LOCAL_CRATE
+        && let FileName::Real(file) = span.filename(sess)
+    {
+        Some(file)
+    } else {
+        None
+    }
 }
 
 impl LocalSourcesCollector<'_, '_> {
@@ -60,16 +66,8 @@ impl LocalSourcesCollector<'_, '_> {
         let span = item.span(self.tcx);
         let Some(span) = span else { return };
         // skip all synthetic "files"
-        if !is_real_and_local(span, sess) {
-            return;
-        }
-        let filename = span.filename(sess);
-        let p = if let FileName::Real(file) = filename {
-            match file.into_local_path() {
-                Some(p) => p,
-                None => return,
-            }
-        } else {
+        let Some(p) = filename_real_and_local(span, sess).and_then(|file| file.into_local_path())
+        else {
             return;
         };
         if self.local_sources.contains_key(&*p) {
@@ -135,8 +133,7 @@ impl DocVisitor<'_> for SourceCollector<'_, '_> {
         // If we're not rendering sources, there's nothing to do.
         // If we're including source files, and we haven't seen this file yet,
         // then we need to render it out to the filesystem.
-        if is_real_and_local(span, sess) {
-            let filename = span.filename(sess);
+        if let Some(filename) = filename_real_and_local(span, sess) {
             let span = span.inner();
             let pos = sess.source_map().lookup_source_file(span.lo());
             let file_span = span.with_lo(pos.start_pos).with_hi(pos.end_position());
@@ -152,7 +149,7 @@ impl DocVisitor<'_> for SourceCollector<'_, '_> {
                         span,
                         format!(
                             "failed to render source code for `{filename}`: {e}",
-                            filename = filename.prefer_local(),
+                            filename = filename.to_string_lossy(FileNameDisplayPreference::Local),
                         ),
                     );
                     false
@@ -168,18 +165,13 @@ impl SourceCollector<'_, '_> {
     /// Renders the given filename into its corresponding HTML source file.
     fn emit_source(
         &mut self,
-        filename: &FileName,
+        file: &RealFileName,
         file_span: rustc_span::Span,
     ) -> Result<(), Error> {
-        let p = match *filename {
-            FileName::Real(ref file) => {
-                if let Some(local_path) = file.local_path() {
-                    local_path.to_path_buf()
-                } else {
-                    unreachable!("only the current crate should have sources emitted");
-                }
-            }
-            _ => return Ok(()),
+        let p = if let Some(local_path) = file.local_path() {
+            local_path.to_path_buf()
+        } else {
+            unreachable!("only the current crate should have sources emitted");
         };
         if self.emitted_local_sources.contains(&*p) {
             // We've already emitted this source
@@ -233,8 +225,10 @@ impl SourceCollector<'_, '_> {
         cur.push(&fname);
 
         let title = format!("{} - source", src_fname.to_string_lossy());
-        let desc =
-            format!("Source of the Rust file `{}`.", filename.prefer_remapped_unconditionaly());
+        let desc = format!(
+            "Source of the Rust file `{}`.",
+            file.to_string_lossy(FileNameDisplayPreference::Remapped)
+        );
         let page = layout::Page {
             title: &title,
             css_class: "src",
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs
index 9efcf6b4983..789a5614967 100644
--- a/src/librustdoc/json/mod.rs
+++ b/src/librustdoc/json/mod.rs
@@ -163,11 +163,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
     }
 
     fn save_module_data(&mut self) -> Self::ModuleData {
-        unreachable!("RUN_ON_MODULE = false should never call save_module_data")
+        unreachable!("RUN_ON_MODULE = false, should never call save_module_data")
     }
-
-    fn set_back_info(&mut self, _info: Self::ModuleData) {
-        unreachable!("RUN_ON_MODULE = false should never call set_back_info")
+    fn restore_module_data(&mut self, _info: Self::ModuleData) {
+        unreachable!("RUN_ON_MODULE = false, should never call set_back_info")
     }
 
     /// Inserts an item into the index. This should be used rather than directly calling insert on
@@ -248,7 +247,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
     }
 
     fn mod_item_in(&mut self, _item: &clean::Item) -> Result<(), Error> {
-        unreachable!("RUN_ON_MODULE = false should never call mod_item_in")
+        unreachable!("RUN_ON_MODULE = false, should never call mod_item_in")
     }
 
     fn after_krate(&mut self) -> Result<(), Error> {
diff --git a/src/llvm-project b/src/llvm-project
-Subproject 104d0d16c3c7c3fef2435fef6efb2d57b70fff7
+Subproject 1268e87bdbaed0693a9d782ccd5a21e2cab2de3
diff --git a/src/tools/compiletest/src/compute_diff.rs b/src/tools/compiletest/src/compute_diff.rs
index 92c80c27de0..3ace6c5b6d7 100644
--- a/src/tools/compiletest/src/compute_diff.rs
+++ b/src/tools/compiletest/src/compute_diff.rs
@@ -144,7 +144,7 @@ where
     }
 
     if !wrote_data {
-        println!("note: diff is identical to nightly rustdoc");
+        eprintln!("note: diff is identical to nightly rustdoc");
         assert!(diff_output.metadata().unwrap().len() == 0);
         return false;
     } else if verbose {
diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs
index b605bc813f1..e75c8a5993e 100644
--- a/src/tools/compiletest/src/debuggers.rs
+++ b/src/tools/compiletest/src/debuggers.rs
@@ -20,7 +20,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> {
     }
 
     if config.remote_test_client.is_some() && !config.target.contains("android") {
-        println!(
+        eprintln!(
             "WARNING: debuginfo tests are not available when \
              testing with remote"
         );
@@ -28,7 +28,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> {
     }
 
     if config.target.contains("android") {
-        println!(
+        eprintln!(
             "{} debug-info test uses tcp 5039 port.\
              please reserve it",
             config.target
@@ -50,7 +50,7 @@ pub(crate) fn configure_lldb(config: &Config) -> Option<Arc<Config>> {
     config.lldb_python_dir.as_ref()?;
 
     if let Some(350) = config.lldb_version {
-        println!(
+        eprintln!(
             "WARNING: The used version of LLDB (350) has a \
              known issue that breaks debuginfo tests. See \
              issue #32520 for more information. Skipping all \
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index bf4a3124075..447568065f5 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -188,8 +188,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
     let (argv0, args_) = args.split_first().unwrap();
     if args.len() == 1 || args[1] == "-h" || args[1] == "--help" {
         let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
-        println!("{}", opts.usage(&message));
-        println!();
+        eprintln!("{}", opts.usage(&message));
+        eprintln!();
         panic!()
     }
 
@@ -200,8 +200,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
 
     if matches.opt_present("h") || matches.opt_present("help") {
         let message = format!("Usage: {} [OPTIONS]  [TESTNAME...]", argv0);
-        println!("{}", opts.usage(&message));
-        println!();
+        eprintln!("{}", opts.usage(&message));
+        eprintln!();
         panic!()
     }
 
@@ -501,7 +501,7 @@ pub fn run_tests(config: Arc<Config>) {
             // easy to miss which tests failed, and as such fail to reproduce
             // the failure locally.
 
-            println!(
+            eprintln!(
                 "Some tests failed in compiletest suite={}{} mode={} host={} target={}",
                 config.suite,
                 config
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 84269fd44a1..8c747a1d93f 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -774,20 +774,20 @@ impl<'test> TestCx<'test> {
                 unexpected.len(),
                 not_found.len()
             ));
-            println!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);
+            eprintln!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline);
             if !unexpected.is_empty() {
-                println!("{}", "--- unexpected errors (from JSON output) ---".green());
+                eprintln!("{}", "--- unexpected errors (from JSON output) ---".green());
                 for error in &unexpected {
-                    println!("{}", error.render_for_expected());
+                    eprintln!("{}", error.render_for_expected());
                 }
-                println!("{}", "---".green());
+                eprintln!("{}", "---".green());
             }
             if !not_found.is_empty() {
-                println!("{}", "--- not found errors (from test file) ---".red());
+                eprintln!("{}", "--- not found errors (from test file) ---".red());
                 for error in &not_found {
-                    println!("{}", error.render_for_expected());
+                    eprintln!("{}", error.render_for_expected());
                 }
-                println!("{}", "---\n".red());
+                eprintln!("{}", "---\n".red());
             }
             panic!("errors differ from expected");
         }
@@ -1876,18 +1876,18 @@ impl<'test> TestCx<'test> {
 
     fn maybe_dump_to_stdout(&self, out: &str, err: &str) {
         if self.config.verbose {
-            println!("------stdout------------------------------");
-            println!("{}", out);
-            println!("------stderr------------------------------");
-            println!("{}", err);
-            println!("------------------------------------------");
+            eprintln!("------stdout------------------------------");
+            eprintln!("{}", out);
+            eprintln!("------stderr------------------------------");
+            eprintln!("{}", err);
+            eprintln!("------------------------------------------");
         }
     }
 
     fn error(&self, err: &str) {
         match self.revision {
-            Some(rev) => println!("\nerror in revision `{}`: {}", rev, err),
-            None => println!("\nerror: {}", err),
+            Some(rev) => eprintln!("\nerror in revision `{}`: {}", rev, err),
+            None => eprintln!("\nerror: {}", err),
         }
     }
 
@@ -1972,7 +1972,7 @@ impl<'test> TestCx<'test> {
         if !self.config.has_html_tidy {
             return;
         }
-        println!("info: generating a diff against nightly rustdoc");
+        eprintln!("info: generating a diff against nightly rustdoc");
 
         let suffix =
             self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly");
@@ -2082,7 +2082,7 @@ impl<'test> TestCx<'test> {
                 .output()
                 .unwrap();
             assert!(output.status.success());
-            println!("{}", String::from_utf8_lossy(&output.stdout));
+            eprintln!("{}", String::from_utf8_lossy(&output.stdout));
             eprintln!("{}", String::from_utf8_lossy(&output.stderr));
         } else {
             use colored::Colorize;
@@ -2482,7 +2482,7 @@ impl<'test> TestCx<'test> {
                 )"#
             )
             .replace_all(&output, |caps: &Captures<'_>| {
-                println!("{}", &caps[0]);
+                eprintln!("{}", &caps[0]);
                 caps[0].replace(r"\", "/")
             })
             .replace("\r\n", "\n")
@@ -2581,16 +2581,16 @@ impl<'test> TestCx<'test> {
         if let Err(err) = fs::write(&actual_path, &actual) {
             self.fatal(&format!("failed to write {stream} to `{actual_path:?}`: {err}",));
         }
-        println!("Saved the actual {stream} to {actual_path:?}");
+        eprintln!("Saved the actual {stream} to {actual_path:?}");
 
         let expected_path =
             expected_output_path(self.testpaths, self.revision, &self.config.compare_mode, stream);
 
         if !self.config.bless {
             if expected.is_empty() {
-                println!("normalized {}:\n{}\n", stream, actual);
+                eprintln!("normalized {}:\n{}\n", stream, actual);
             } else {
-                println!("diff of {stream}:\n");
+                eprintln!("diff of {stream}:\n");
                 if let Some(diff_command) = self.config.diff_command.as_deref() {
                     let mut args = diff_command.split_whitespace();
                     let name = args.next().unwrap();
@@ -2625,10 +2625,10 @@ impl<'test> TestCx<'test> {
             if let Err(err) = fs::write(&expected_path, &actual) {
                 self.fatal(&format!("failed to write {stream} to `{expected_path:?}`: {err}"));
             }
-            println!("Blessing the {stream} of {test_name} in {expected_path:?}");
+            eprintln!("Blessing the {stream} of {test_name} in {expected_path:?}");
         }
 
-        println!("\nThe actual {0} differed from the expected {0}.", stream);
+        eprintln!("\nThe actual {0} differed from the expected {0}.", stream);
 
         if self.config.bless { 0 } else { 1 }
     }
@@ -2707,7 +2707,7 @@ impl<'test> TestCx<'test> {
         fs::create_dir_all(&incremental_dir).unwrap();
 
         if self.config.verbose {
-            println!("init_incremental_test: incremental_dir={}", incremental_dir.display());
+            eprintln!("init_incremental_test: incremental_dir={}", incremental_dir.display());
         }
     }
 
@@ -2765,7 +2765,7 @@ impl ProcRes {
             }
         }
 
-        println!(
+        eprintln!(
             "status: {}\ncommand: {}\n{}\n{}\n",
             self.status,
             self.cmdline,
@@ -2776,7 +2776,7 @@ impl ProcRes {
 
     pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
         if let Some(e) = err {
-            println!("\nerror: {}", e);
+            eprintln!("\nerror: {}", e);
         }
         self.print_info();
         on_failure();
diff --git a/src/tools/compiletest/src/runtest/codegen_units.rs b/src/tools/compiletest/src/runtest/codegen_units.rs
index 6c866cbef21..6acd140183d 100644
--- a/src/tools/compiletest/src/runtest/codegen_units.rs
+++ b/src/tools/compiletest/src/runtest/codegen_units.rs
@@ -64,13 +64,13 @@ impl TestCx<'_> {
         if !missing.is_empty() {
             missing.sort();
 
-            println!("\nThese items should have been contained but were not:\n");
+            eprintln!("\nThese items should have been contained but were not:\n");
 
             for item in &missing {
-                println!("{}", item);
+                eprintln!("{}", item);
             }
 
-            println!("\n");
+            eprintln!("\n");
         }
 
         if !unexpected.is_empty() {
@@ -80,24 +80,24 @@ impl TestCx<'_> {
                 sorted
             };
 
-            println!("\nThese items were contained but should not have been:\n");
+            eprintln!("\nThese items were contained but should not have been:\n");
 
             for item in sorted {
-                println!("{}", item);
+                eprintln!("{}", item);
             }
 
-            println!("\n");
+            eprintln!("\n");
         }
 
         if !wrong_cgus.is_empty() {
             wrong_cgus.sort_by_key(|pair| pair.0.name.clone());
-            println!("\nThe following items were assigned to wrong codegen units:\n");
+            eprintln!("\nThe following items were assigned to wrong codegen units:\n");
 
             for &(ref expected_item, ref actual_item) in &wrong_cgus {
-                println!("{}", expected_item.name);
-                println!("  expected: {}", codegen_units_to_str(&expected_item.codegen_units));
-                println!("  actual:   {}", codegen_units_to_str(&actual_item.codegen_units));
-                println!();
+                eprintln!("{}", expected_item.name);
+                eprintln!("  expected: {}", codegen_units_to_str(&expected_item.codegen_units));
+                eprintln!("  actual:   {}", codegen_units_to_str(&actual_item.codegen_units));
+                eprintln!();
             }
         }
 
diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs
index c621c22ac99..7322e730e53 100644
--- a/src/tools/compiletest/src/runtest/debuginfo.rs
+++ b/src/tools/compiletest/src/runtest/debuginfo.rs
@@ -260,7 +260,7 @@ impl TestCx<'_> {
                 cmdline,
             };
             if adb.kill().is_err() {
-                println!("Adb process is already finished.");
+                eprintln!("Adb process is already finished.");
             }
         } else {
             let rust_src_root =
@@ -275,7 +275,7 @@ impl TestCx<'_> {
 
             match self.config.gdb_version {
                 Some(version) => {
-                    println!("NOTE: compiletest thinks it is using GDB version {}", version);
+                    eprintln!("NOTE: compiletest thinks it is using GDB version {}", version);
 
                     if version > extract_gdb_version("7.4").unwrap() {
                         // Add the directory containing the pretty printers to
@@ -297,7 +297,7 @@ impl TestCx<'_> {
                     }
                 }
                 _ => {
-                    println!(
+                    eprintln!(
                         "NOTE: compiletest does not know which version of \
                          GDB it is using"
                     );
@@ -392,10 +392,10 @@ impl TestCx<'_> {
 
         match self.config.lldb_version {
             Some(ref version) => {
-                println!("NOTE: compiletest thinks it is using LLDB version {}", version);
+                eprintln!("NOTE: compiletest thinks it is using LLDB version {}", version);
             }
             _ => {
-                println!(
+                eprintln!(
                     "NOTE: compiletest does not know which version of \
                      LLDB it is using"
                 );
diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs
index 31fdb0a5d13..84376d346af 100644
--- a/src/tools/compiletest/src/runtest/rustdoc_json.rs
+++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs
@@ -29,7 +29,7 @@ impl TestCx<'_> {
 
         if !res.status.success() {
             self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| {
-                println!("Rustdoc Output:");
+                eprintln!("Rustdoc Output:");
                 proc_res.print_info();
             })
         }
diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs
index bb747c68029..414f1a6adb3 100644
--- a/src/tools/compiletest/src/runtest/ui.rs
+++ b/src/tools/compiletest/src/runtest/ui.rs
@@ -109,10 +109,10 @@ impl TestCx<'_> {
         }
 
         if errors > 0 {
-            println!("To update references, rerun the tests and pass the `--bless` flag");
+            eprintln!("To update references, rerun the tests and pass the `--bless` flag");
             let relative_path_to_file =
                 self.testpaths.relative_dir.join(self.testpaths.file.file_name().unwrap());
-            println!(
+            eprintln!(
                 "To only update this specific test, also pass `--test-args {}`",
                 relative_path_to_file.display(),
             );
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index bff02f1db9f..7b50e62c29b 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -30,7 +30,7 @@ fn path_div() -> &'static str {
 pub fn logv(config: &Config, s: String) {
     debug!("{}", s);
     if config.verbose {
-        println!("{}", s);
+        eprintln!("{}", s);
     }
 }
 
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs
index e2d1b85797f..9dc49b57d59 100644
--- a/src/tools/tidy/src/error_codes.rs
+++ b/src/tools/tidy/src/error_codes.rs
@@ -38,7 +38,7 @@ const IGNORE_UI_TEST_CHECK: &[&str] =
 macro_rules! verbose_print {
     ($verbose:expr, $($fmt:tt)*) => {
         if $verbose {
-            println!("{}", format_args!($($fmt)*));
+            eprintln!("{}", format_args!($($fmt)*));
         }
     };
 }
@@ -49,8 +49,8 @@ pub fn check(root_path: &Path, search_paths: &[&Path], verbose: bool, bad: &mut
     // Stage 1: create list
     let error_codes = extract_error_codes(root_path, &mut errors);
     if verbose {
-        println!("Found {} error codes", error_codes.len());
-        println!("Highest error code: `{}`", error_codes.iter().max().unwrap());
+        eprintln!("Found {} error codes", error_codes.len());
+        eprintln!("Highest error code: `{}`", error_codes.iter().max().unwrap());
     }
 
     // Stage 2: check list has docs
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index 4f24eb21242..4607d041577 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -158,14 +158,14 @@ pub fn check(
         .collect::<Vec<_>>();
 
     for &(name, _) in gate_untested.iter() {
-        println!("Expected a gate test for the feature '{name}'.");
-        println!(
+        eprintln!("Expected a gate test for the feature '{name}'.");
+        eprintln!(
             "Hint: create a failing test file named 'tests/ui/feature-gates/feature-gate-{}.rs',\
                 \n      with its failures due to missing usage of `#![feature({})]`.",
             name.replace("_", "-"),
             name
         );
-        println!(
+        eprintln!(
             "Hint: If you already have such a test and don't want to rename it,\
                 \n      you can also add a // gate-test-{} line to the test file.",
             name
@@ -218,7 +218,7 @@ pub fn check(
 
         lines.sort();
         for line in lines {
-            println!("* {line}");
+            eprintln!("* {line}");
         }
     }
 
diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs
index 8be25b98df0..06d238ef5e4 100644
--- a/src/tools/tidy/src/unstable_book.rs
+++ b/src/tools/tidy/src/unstable_book.rs
@@ -118,16 +118,16 @@ pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) {
     // List unstable features that don't have Unstable Book sections.
     // Remove the comment marker if you want the list printed.
     /*
-    println!("Lib features without unstable book sections:");
+    eprintln!("Lib features without unstable book sections:");
     for feature_name in &unstable_lang_feature_names -
                         &unstable_book_lang_features_section_file_names {
-        println!("    * {} {:?}", feature_name, lib_features[&feature_name].tracking_issue);
+        eprintln!("    * {} {:?}", feature_name, lib_features[&feature_name].tracking_issue);
     }
 
-    println!("Lang features without unstable book sections:");
+    eprintln!("Lang features without unstable book sections:");
     for feature_name in &unstable_lib_feature_names-
                         &unstable_book_lib_features_section_file_names {
-        println!("    * {} {:?}", feature_name, lang_features[&feature_name].tracking_issue);
+        eprintln!("    * {} {:?}", feature_name, lang_features[&feature_name].tracking_issue);
     }
     // */
 }
diff --git a/src/tools/tidy/src/x_version.rs b/src/tools/tidy/src/x_version.rs
index 489343561e1..b43d56202c9 100644
--- a/src/tools/tidy/src/x_version.rs
+++ b/src/tools/tidy/src/x_version.rs
@@ -42,7 +42,7 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
 
         if let Some(expected) = get_x_wrapper_version(root, cargo) {
             if installed < expected {
-                return println!(
+                return eprintln!(
                     "Current version of x is {installed}, but the latest version is {expected}\nConsider updating to the newer version of x by running `cargo install --path src/tools/x`"
                 );
             }
diff --git a/tests/coverage/abort.cov-map b/tests/coverage/abort.cov-map
index c121fa551dc..396edec275d 100644
--- a/tests/coverage/abort.cov-map
+++ b/tests/coverage/abort.cov-map
@@ -1,34 +1,34 @@
 Function name: abort::main
-Raw bytes (89): 0x[01, 01, 0a, 01, 27, 05, 09, 03, 0d, 22, 11, 03, 0d, 03, 0d, 22, 15, 03, 0d, 03, 0d, 05, 09, 0d, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 22, 01, 0c, 00, 19, 11, 00, 1a, 02, 0a, 0e, 02, 09, 00, 0a, 22, 02, 0c, 00, 19, 15, 00, 1a, 00, 31, 1a, 00, 30, 00, 31, 22, 04, 0c, 00, 19, 05, 00, 1a, 00, 31, 09, 00, 30, 00, 31, 27, 01, 09, 00, 17, 0d, 02, 05, 01, 02]
+Raw bytes (89): 0x[01, 01, 0a, 07, 09, 01, 05, 03, 0d, 03, 13, 0d, 11, 03, 0d, 03, 1f, 0d, 15, 03, 0d, 05, 09, 0d, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 22, 01, 0c, 00, 19, 11, 00, 1a, 02, 0a, 0e, 02, 09, 00, 0a, 22, 02, 0c, 00, 19, 15, 00, 1a, 00, 31, 1a, 00, 30, 00, 31, 22, 04, 0c, 00, 19, 05, 00, 1a, 00, 31, 09, 00, 30, 00, 31, 27, 01, 09, 00, 17, 0d, 02, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 10
-- expression 0 operands: lhs = Counter(0), rhs = Expression(9, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Expression(8, Sub), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Expression(4, Add)
+- expression 4 operands: lhs = Counter(3), rhs = Counter(4)
 - expression 5 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 6 operands: lhs = Expression(8, Sub), rhs = Counter(5)
-- expression 7 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Expression(0, Add), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(3), rhs = Counter(5)
 - expression 8 operands: lhs = Expression(0, Add), rhs = Counter(3)
 - expression 9 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 13
 - Code(Counter(0)) at (prev + 13, 1) to (start + 1, 27)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
-    = (c0 + (c1 + c2))
+    = ((c0 + c1) + c2)
 - Code(Expression(8, Sub)) at (prev + 1, 12) to (start + 0, 25)
-    = ((c0 + (c1 + c2)) - c3)
+    = (((c0 + c1) + c2) - c3)
 - Code(Counter(4)) at (prev + 0, 26) to (start + 2, 10)
 - Code(Expression(3, Sub)) at (prev + 2, 9) to (start + 0, 10)
-    = (((c0 + (c1 + c2)) - c3) - c4)
+    = (((c0 + c1) + c2) - (c3 + c4))
 - Code(Expression(8, Sub)) at (prev + 2, 12) to (start + 0, 25)
-    = ((c0 + (c1 + c2)) - c3)
+    = (((c0 + c1) + c2) - c3)
 - Code(Counter(5)) at (prev + 0, 26) to (start + 0, 49)
 - Code(Expression(6, Sub)) at (prev + 0, 48) to (start + 0, 49)
-    = (((c0 + (c1 + c2)) - c3) - c5)
+    = (((c0 + c1) + c2) - (c3 + c5))
 - Code(Expression(8, Sub)) at (prev + 4, 12) to (start + 0, 25)
-    = ((c0 + (c1 + c2)) - c3)
+    = (((c0 + c1) + c2) - c3)
 - Code(Counter(1)) at (prev + 0, 26) to (start + 0, 49)
 - Code(Counter(2)) at (prev + 0, 48) to (start + 0, 49)
 - Code(Expression(9, Add)) at (prev + 1, 9) to (start + 0, 23)
diff --git a/tests/coverage/assert.cov-map b/tests/coverage/assert.cov-map
index b3cec390119..3bbf7a43e6d 100644
--- a/tests/coverage/assert.cov-map
+++ b/tests/coverage/assert.cov-map
@@ -1,29 +1,30 @@
 Function name: assert::main
-Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 09, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 09, 00, 0a, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Raw bytes (67): 0x[01, 01, 09, 07, 0d, 0b, 09, 01, 05, 03, 11, 17, 11, 1b, 0d, 01, 09, 23, 0d, 05, 09, 09, 01, 09, 01, 01, 1b, 03, 02, 0b, 00, 18, 0e, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 09, 00, 0a, 1f, 01, 09, 00, 17, 11, 02, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 8
-- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+Number of expressions: 9
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
-- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 9, 1) to (start + 1, 27)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
-    = (c0 + (c1 + (c2 + c3)))
-- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
-    = ((c0 + (c1 + (c2 + c3))) - c4)
+    = (((c0 + c1) + c2) + c3)
+- Code(Expression(3, Sub)) at (prev + 1, 12) to (start + 0, 26)
+    = ((((c0 + c1) + c2) + c3) - c4)
 - Code(Counter(1)) at (prev + 0, 27) to (start + 2, 10)
 - Code(Expression(4, Sub)) at (prev + 2, 19) to (start + 0, 32)
-    = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+    = (((c0 + c2) + c3) - c4)
 - Code(Counter(2)) at (prev + 0, 33) to (start + 2, 10)
 - Code(Counter(3)) at (prev + 2, 9) to (start + 0, 10)
-- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (c1 + (c2 + c3))
+- Code(Expression(7, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = ((c1 + c2) + c3)
 - Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/async.cov-map b/tests/coverage/async.cov-map
index 9a67cefcf98..c51bc6eb621 100644
--- a/tests/coverage/async.cov-map
+++ b/tests/coverage/async.cov-map
@@ -155,25 +155,25 @@ Number of file 0 mappings: 1
 Highest counter ID seen: c0
 
 Function name: async::i::{closure#0}
-Raw bytes (63): 0x[01, 01, 02, 07, 19, 11, 15, 0b, 01, 2d, 13, 04, 0c, 09, 05, 09, 00, 0a, 01, 00, 0e, 00, 18, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 15, 01, 09, 00, 0a, 0d, 00, 0e, 00, 17, 1d, 00, 1b, 00, 20, 15, 00, 24, 00, 26, 19, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
+Raw bytes (63): 0x[01, 01, 02, 07, 15, 0d, 11, 0b, 01, 2d, 13, 04, 0c, 09, 05, 09, 00, 0a, 01, 00, 0e, 00, 18, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 11, 01, 09, 00, 0a, 19, 00, 0e, 00, 17, 1d, 00, 1b, 00, 20, 11, 00, 24, 00, 26, 15, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 2
-- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(6)
-- expression 1 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(5)
+- expression 1 operands: lhs = Counter(3), rhs = Counter(4)
 Number of file 0 mappings: 11
 - Code(Counter(0)) at (prev + 45, 19) to (start + 4, 12)
 - Code(Counter(2)) at (prev + 5, 9) to (start + 0, 10)
 - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 24)
 - Code(Counter(1)) at (prev + 0, 28) to (start + 0, 33)
 - Code(Counter(2)) at (prev + 0, 39) to (start + 0, 48)
-- Code(Counter(5)) at (prev + 1, 9) to (start + 0, 10)
-- Code(Counter(3)) at (prev + 0, 14) to (start + 0, 23)
+- Code(Counter(4)) at (prev + 1, 9) to (start + 0, 10)
+- Code(Counter(6)) at (prev + 0, 14) to (start + 0, 23)
 - Code(Counter(7)) at (prev + 0, 27) to (start + 0, 32)
-- Code(Counter(5)) at (prev + 0, 36) to (start + 0, 38)
-- Code(Counter(6)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Counter(4)) at (prev + 0, 36) to (start + 0, 38)
+- Code(Counter(5)) at (prev + 1, 14) to (start + 0, 16)
 - Code(Expression(0, Add)) at (prev + 2, 1) to (start + 0, 2)
-    = ((c4 + c5) + c6)
+    = ((c3 + c4) + c5)
 Highest counter ID seen: c7
 
 Function name: async::j
@@ -243,22 +243,19 @@ Number of file 0 mappings: 5
 Highest counter ID seen: (none)
 
 Function name: async::l
-Raw bytes (37): 0x[01, 01, 04, 01, 07, 05, 09, 0f, 02, 09, 05, 05, 01, 52, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02]
+Raw bytes (33): 0x[01, 01, 02, 01, 07, 05, 09, 05, 01, 52, 01, 01, 0c, 02, 02, 0e, 00, 10, 09, 01, 0e, 00, 10, 05, 01, 0e, 00, 10, 01, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 2
 - expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
 - expression 1 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 2 operands: lhs = Expression(3, Add), rhs = Expression(0, Sub)
-- expression 3 operands: lhs = Counter(2), rhs = Counter(1)
 Number of file 0 mappings: 5
 - Code(Counter(0)) at (prev + 82, 1) to (start + 1, 12)
 - Code(Expression(0, Sub)) at (prev + 2, 14) to (start + 0, 16)
     = (c0 - (c1 + c2))
-- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 16)
 - Code(Counter(2)) at (prev + 1, 14) to (start + 0, 16)
-- Code(Expression(2, Add)) at (prev + 2, 1) to (start + 0, 2)
-    = ((c2 + c1) + (c0 - (c1 + c2)))
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 16)
+- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
 Highest counter ID seen: c2
 
 Function name: async::m
diff --git a/tests/coverage/branch/guard.cov-map b/tests/coverage/branch/guard.cov-map
index 0f33ed17a0a..1ba1c6e1228 100644
--- a/tests/coverage/branch/guard.cov-map
+++ b/tests/coverage/branch/guard.cov-map
@@ -1,5 +1,5 @@
 Function name: guard::branch_match_guard
-Raw bytes (85): 0x[01, 01, 06, 19, 0d, 05, 09, 0f, 15, 13, 11, 17, 0d, 05, 09, 0d, 01, 0c, 01, 01, 10, 1d, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 19, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 1d, 00, 14, 00, 19, 20, 11, 09, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 17, 03, 0e, 02, 0a, 0b, 04, 01, 00, 02]
+Raw bytes (85): 0x[01, 01, 06, 19, 0d, 05, 09, 0f, 15, 13, 11, 17, 0d, 05, 09, 0d, 01, 0c, 01, 01, 10, 02, 03, 0b, 00, 0c, 15, 01, 14, 02, 0a, 0d, 03, 0e, 00, 0f, 19, 00, 14, 00, 19, 20, 0d, 02, 00, 14, 00, 1e, 0d, 00, 1d, 02, 0a, 11, 03, 0e, 00, 0f, 02, 00, 14, 00, 19, 20, 11, 05, 00, 14, 00, 1e, 11, 00, 1d, 02, 0a, 17, 03, 0e, 02, 0a, 0b, 04, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 6
@@ -11,7 +11,8 @@ Number of expressions: 6
 - expression 5 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 13
 - Code(Counter(0)) at (prev + 12, 1) to (start + 1, 16)
-- Code(Counter(7)) at (prev + 3, 11) to (start + 0, 12)
+- Code(Expression(0, Sub)) at (prev + 3, 11) to (start + 0, 12)
+    = (c6 - c3)
 - Code(Counter(5)) at (prev + 1, 20) to (start + 2, 10)
 - Code(Counter(3)) at (prev + 3, 14) to (start + 0, 15)
 - Code(Counter(6)) at (prev + 0, 20) to (start + 0, 25)
@@ -20,14 +21,15 @@ Number of file 0 mappings: 13
     false = (c6 - c3)
 - Code(Counter(3)) at (prev + 0, 29) to (start + 2, 10)
 - Code(Counter(4)) at (prev + 3, 14) to (start + 0, 15)
-- Code(Counter(7)) at (prev + 0, 20) to (start + 0, 25)
-- Branch { true: Counter(4), false: Counter(2) } at (prev + 0, 20) to (start + 0, 30)
+- Code(Expression(0, Sub)) at (prev + 0, 20) to (start + 0, 25)
+    = (c6 - c3)
+- Branch { true: Counter(4), false: Counter(1) } at (prev + 0, 20) to (start + 0, 30)
     true  = c4
-    false = c2
+    false = c1
 - Code(Counter(4)) at (prev + 0, 29) to (start + 2, 10)
 - Code(Expression(5, Add)) at (prev + 3, 14) to (start + 2, 10)
     = (c1 + c2)
 - Code(Expression(2, Add)) at (prev + 4, 1) to (start + 0, 2)
     = ((((c1 + c2) + c3) + c4) + c5)
-Highest counter ID seen: c7
+Highest counter ID seen: c6
 
diff --git a/tests/coverage/branch/if.cov-map b/tests/coverage/branch/if.cov-map
index 0ad78a720a7..bab982dd44c 100644
--- a/tests/coverage/branch/if.cov-map
+++ b/tests/coverage/branch/if.cov-map
@@ -1,12 +1,14 @@
 Function name: if::branch_and
-Raw bytes (56): 0x[01, 01, 04, 05, 09, 0d, 02, 11, 0f, 0d, 02, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 11, 0d, 00, 0d, 00, 0e, 11, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (60): 0x[01, 01, 06, 05, 09, 0b, 09, 05, 11, 13, 09, 17, 11, 05, 0d, 08, 01, 2b, 01, 01, 10, 05, 03, 08, 00, 09, 20, 09, 02, 00, 08, 00, 09, 09, 00, 0d, 00, 0e, 20, 0d, 11, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 6
 - expression 0 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 1 operands: lhs = Counter(3), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(4), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(3), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Counter(1), rhs = Counter(3)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 43, 1) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 3, 8) to (start + 0, 9)
@@ -14,14 +16,14 @@ Number of file 0 mappings: 8
     true  = c2
     false = (c1 - c2)
 - Code(Counter(2)) at (prev + 0, 13) to (start + 0, 14)
-- Branch { true: Counter(4), false: Counter(3) } at (prev + 0, 13) to (start + 0, 14)
-    true  = c4
-    false = c3
-- Code(Counter(4)) at (prev + 0, 15) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c3 + (c1 - c2))
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c4 + (c3 + (c1 - c2)))
+- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 13) to (start + 0, 14)
+    true  = c3
+    false = c4
+- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c1 + c4) - c2)
+- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c1 + c3) + c4) - c2)
 Highest counter ID seen: c4
 
 Function name: if::branch_not
diff --git a/tests/coverage/branch/lazy-boolean.cov-map b/tests/coverage/branch/lazy-boolean.cov-map
index c2b6a5b8df2..decb847f60e 100644
--- a/tests/coverage/branch/lazy-boolean.cov-map
+++ b/tests/coverage/branch/lazy-boolean.cov-map
@@ -34,39 +34,49 @@ Number of file 0 mappings: 6
 Highest counter ID seen: c2
 
 Function name: lazy_boolean::chain
-Raw bytes (149): 0x[01, 01, 13, 11, 07, 0b, 16, 15, 1a, 09, 0d, 05, 09, 05, 09, 09, 0d, 47, 25, 4b, 21, 19, 1d, 03, 19, 03, 19, 3e, 1d, 03, 19, 3e, 1d, 03, 19, 47, 25, 4b, 21, 19, 1d, 13, 01, 24, 01, 01, 10, 03, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 16, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 1a, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 15, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 03, 01, 05, 00, 11, 43, 03, 09, 00, 0a, 03, 00, 0d, 00, 12, 20, 19, 3e, 00, 0d, 00, 12, 3e, 00, 16, 00, 1b, 20, 1d, 3a, 00, 16, 00, 1b, 3a, 00, 1f, 00, 24, 20, 21, 25, 00, 1f, 00, 24, 25, 00, 28, 00, 2d, 43, 01, 05, 01, 02]
+Raw bytes (169): 0x[01, 01, 1d, 5b, 0d, 5f, 15, 05, 11, 05, 09, 09, 0d, 6f, 25, 73, 21, 19, 1d, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 67, 5f, 15, 05, 11, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 5b, 63, 5f, 15, 05, 11, 67, 1d, 0d, 19, 6f, 25, 73, 21, 19, 1d, 13, 01, 24, 01, 01, 10, 02, 04, 09, 00, 0a, 05, 00, 0d, 00, 12, 20, 09, 0e, 00, 0d, 00, 12, 09, 00, 16, 00, 1b, 20, 0d, 12, 00, 16, 00, 1b, 0d, 00, 1f, 00, 24, 20, 11, 15, 00, 1f, 00, 24, 11, 00, 28, 00, 2d, 02, 01, 05, 00, 11, 6b, 03, 09, 00, 0a, 02, 00, 0d, 00, 12, 20, 19, 32, 00, 0d, 00, 12, 32, 00, 16, 00, 1b, 20, 1d, 56, 00, 16, 00, 1b, 56, 00, 1f, 00, 24, 20, 21, 25, 00, 1f, 00, 24, 25, 00, 28, 00, 2d, 6b, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 19
-- expression 0 operands: lhs = Counter(4), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(5, Sub)
-- expression 2 operands: lhs = Counter(5), rhs = Expression(6, Sub)
-- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 7 operands: lhs = Expression(17, Add), rhs = Counter(9)
-- expression 8 operands: lhs = Expression(18, Add), rhs = Counter(8)
-- expression 9 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 10 operands: lhs = Expression(0, Add), rhs = Counter(6)
-- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(6)
-- expression 12 operands: lhs = Expression(15, Sub), rhs = Counter(7)
-- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(6)
-- expression 14 operands: lhs = Expression(15, Sub), rhs = Counter(7)
-- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(6)
-- expression 16 operands: lhs = Expression(17, Add), rhs = Counter(9)
-- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(8)
-- expression 18 operands: lhs = Counter(6), rhs = Counter(7)
+Number of expressions: 29
+- expression 0 operands: lhs = Expression(22, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 5 operands: lhs = Expression(27, Add), rhs = Counter(9)
+- expression 6 operands: lhs = Expression(28, Add), rhs = Counter(8)
+- expression 7 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 8 operands: lhs = Expression(22, Add), rhs = Expression(25, Add)
+- expression 9 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 10 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 11 operands: lhs = Counter(3), rhs = Counter(6)
+- expression 12 operands: lhs = Expression(22, Add), rhs = Expression(25, Add)
+- expression 13 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 14 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 15 operands: lhs = Counter(3), rhs = Counter(6)
+- expression 16 operands: lhs = Expression(22, Add), rhs = Expression(24, Add)
+- expression 17 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 18 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 19 operands: lhs = Expression(25, Add), rhs = Counter(7)
+- expression 20 operands: lhs = Counter(3), rhs = Counter(6)
+- expression 21 operands: lhs = Expression(22, Add), rhs = Expression(24, Add)
+- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 23 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 24 operands: lhs = Expression(25, Add), rhs = Counter(7)
+- expression 25 operands: lhs = Counter(3), rhs = Counter(6)
+- expression 26 operands: lhs = Expression(27, Add), rhs = Counter(9)
+- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(8)
+- expression 28 operands: lhs = Counter(6), rhs = Counter(7)
 Number of file 0 mappings: 19
 - Code(Counter(0)) at (prev + 36, 1) to (start + 1, 16)
-- Code(Expression(0, Add)) at (prev + 4, 9) to (start + 0, 10)
-    = (c4 + ((c5 + (c2 - c3)) + (c1 - c2)))
+- Code(Expression(0, Sub)) at (prev + 4, 9) to (start + 0, 10)
+    = (((c1 + c4) + c5) - c3)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 18)
-- Branch { true: Counter(2), false: Expression(5, Sub) } at (prev + 0, 13) to (start + 0, 18)
+- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 18)
     true  = c2
     false = (c1 - c2)
 - Code(Counter(2)) at (prev + 0, 22) to (start + 0, 27)
-- Branch { true: Counter(3), false: Expression(6, Sub) } at (prev + 0, 22) to (start + 0, 27)
+- Branch { true: Counter(3), false: Expression(4, Sub) } at (prev + 0, 22) to (start + 0, 27)
     true  = c3
     false = (c2 - c3)
 - Code(Counter(3)) at (prev + 0, 31) to (start + 0, 36)
@@ -74,97 +84,87 @@ Number of file 0 mappings: 19
     true  = c4
     false = c5
 - Code(Counter(4)) at (prev + 0, 40) to (start + 0, 45)
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 0, 17)
-    = (c4 + ((c5 + (c2 - c3)) + (c1 - c2)))
-- Code(Expression(16, Add)) at (prev + 3, 9) to (start + 0, 10)
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 17)
+    = (((c1 + c4) + c5) - c3)
+- Code(Expression(26, Add)) at (prev + 3, 9) to (start + 0, 10)
     = (((c6 + c7) + c8) + c9)
-- Code(Expression(0, Add)) at (prev + 0, 13) to (start + 0, 18)
-    = (c4 + ((c5 + (c2 - c3)) + (c1 - c2)))
-- Branch { true: Counter(6), false: Expression(15, Sub) } at (prev + 0, 13) to (start + 0, 18)
+- Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 18)
+    = (((c1 + c4) + c5) - c3)
+- Branch { true: Counter(6), false: Expression(12, Sub) } at (prev + 0, 13) to (start + 0, 18)
     true  = c6
-    false = ((c4 + ((c5 + (c2 - c3)) + (c1 - c2))) - c6)
-- Code(Expression(15, Sub)) at (prev + 0, 22) to (start + 0, 27)
-    = ((c4 + ((c5 + (c2 - c3)) + (c1 - c2))) - c6)
-- Branch { true: Counter(7), false: Expression(14, Sub) } at (prev + 0, 22) to (start + 0, 27)
+    false = (((c1 + c4) + c5) - (c3 + c6))
+- Code(Expression(12, Sub)) at (prev + 0, 22) to (start + 0, 27)
+    = (((c1 + c4) + c5) - (c3 + c6))
+- Branch { true: Counter(7), false: Expression(21, Sub) } at (prev + 0, 22) to (start + 0, 27)
     true  = c7
-    false = (((c4 + ((c5 + (c2 - c3)) + (c1 - c2))) - c6) - c7)
-- Code(Expression(14, Sub)) at (prev + 0, 31) to (start + 0, 36)
-    = (((c4 + ((c5 + (c2 - c3)) + (c1 - c2))) - c6) - c7)
+    false = (((c1 + c4) + c5) - ((c3 + c6) + c7))
+- Code(Expression(21, Sub)) at (prev + 0, 31) to (start + 0, 36)
+    = (((c1 + c4) + c5) - ((c3 + c6) + c7))
 - Branch { true: Counter(8), false: Counter(9) } at (prev + 0, 31) to (start + 0, 36)
     true  = c8
     false = c9
 - Code(Counter(9)) at (prev + 0, 40) to (start + 0, 45)
-- Code(Expression(16, Add)) at (prev + 1, 5) to (start + 1, 2)
+- Code(Expression(26, Add)) at (prev + 1, 5) to (start + 1, 2)
     = (((c6 + c7) + c8) + c9)
 Highest counter ID seen: c9
 
 Function name: lazy_boolean::nested_mixed
-Raw bytes (155): 0x[01, 01, 16, 33, 1a, 09, 0d, 1e, 0d, 05, 09, 05, 09, 05, 09, 1e, 0d, 05, 09, 09, 0d, 33, 11, 09, 0d, 33, 11, 09, 0d, 19, 57, 1d, 21, 03, 15, 15, 19, 4a, 4e, 15, 19, 03, 15, 19, 57, 1d, 21, 13, 01, 31, 01, 01, 10, 03, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 1e, 00, 0e, 00, 13, 1e, 00, 17, 00, 1d, 20, 0d, 1a, 00, 17, 00, 1d, 33, 00, 23, 00, 28, 20, 11, 2e, 00, 23, 00, 28, 2e, 00, 2c, 00, 33, 03, 01, 05, 00, 11, 53, 03, 09, 00, 0a, 03, 00, 0e, 00, 13, 20, 15, 4e, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 4a, 00, 17, 00, 1c, 47, 00, 22, 00, 28, 20, 1d, 21, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 53, 01, 05, 01, 02]
+Raw bytes (141): 0x[01, 01, 0f, 05, 09, 05, 1f, 09, 0d, 09, 0d, 1f, 11, 09, 0d, 1f, 11, 09, 0d, 3b, 21, 19, 1d, 05, 15, 15, 19, 05, 19, 3b, 21, 19, 1d, 13, 01, 31, 01, 01, 10, 05, 04, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 09, 02, 00, 0e, 00, 13, 02, 00, 17, 00, 1d, 20, 0d, 06, 00, 17, 00, 1d, 1f, 00, 23, 00, 28, 20, 11, 1a, 00, 23, 00, 28, 1a, 00, 2c, 00, 33, 05, 01, 05, 00, 11, 37, 03, 09, 00, 0a, 05, 00, 0e, 00, 13, 20, 15, 2a, 00, 0e, 00, 13, 15, 00, 17, 00, 1c, 20, 19, 2e, 00, 17, 00, 1c, 32, 00, 22, 00, 28, 20, 1d, 21, 00, 22, 00, 28, 1d, 00, 2c, 00, 33, 37, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 22
-- expression 0 operands: lhs = Expression(12, Add), rhs = Expression(6, Sub)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 2 operands: lhs = Expression(7, Sub), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(3)
-- expression 7 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 8 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 9 operands: lhs = Expression(12, Add), rhs = Counter(4)
-- expression 10 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(4)
-- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 13 operands: lhs = Counter(6), rhs = Expression(21, Add)
-- expression 14 operands: lhs = Counter(7), rhs = Counter(8)
-- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(5)
-- expression 16 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 17 operands: lhs = Expression(18, Sub), rhs = Expression(19, Sub)
-- expression 18 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 19 operands: lhs = Expression(0, Add), rhs = Counter(5)
-- expression 20 operands: lhs = Counter(6), rhs = Expression(21, Add)
-- expression 21 operands: lhs = Counter(7), rhs = Counter(8)
+Number of expressions: 15
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(7, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Expression(14, Add), rhs = Counter(8)
+- expression 9 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 10 operands: lhs = Counter(1), rhs = Counter(5)
+- expression 11 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 12 operands: lhs = Counter(1), rhs = Counter(6)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(8)
+- expression 14 operands: lhs = Counter(6), rhs = Counter(7)
 Number of file 0 mappings: 19
 - Code(Counter(0)) at (prev + 49, 1) to (start + 1, 16)
-- Code(Expression(0, Add)) at (prev + 4, 9) to (start + 0, 10)
-    = ((c2 + c3) + ((c1 - c2) - c3))
+- Code(Counter(1)) at (prev + 4, 9) to (start + 0, 10)
 - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 19)
-- Branch { true: Counter(2), false: Expression(7, Sub) } at (prev + 0, 14) to (start + 0, 19)
+- Branch { true: Counter(2), false: Expression(0, Sub) } at (prev + 0, 14) to (start + 0, 19)
     true  = c2
     false = (c1 - c2)
-- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 29)
+- Code(Expression(0, Sub)) at (prev + 0, 23) to (start + 0, 29)
     = (c1 - c2)
-- Branch { true: Counter(3), false: Expression(6, Sub) } at (prev + 0, 23) to (start + 0, 29)
+- Branch { true: Counter(3), false: Expression(1, Sub) } at (prev + 0, 23) to (start + 0, 29)
     true  = c3
-    false = ((c1 - c2) - c3)
-- Code(Expression(12, Add)) at (prev + 0, 35) to (start + 0, 40)
+    false = (c1 - (c2 + c3))
+- Code(Expression(7, Add)) at (prev + 0, 35) to (start + 0, 40)
     = (c2 + c3)
-- Branch { true: Counter(4), false: Expression(11, Sub) } at (prev + 0, 35) to (start + 0, 40)
+- Branch { true: Counter(4), false: Expression(6, Sub) } at (prev + 0, 35) to (start + 0, 40)
     true  = c4
     false = ((c2 + c3) - c4)
-- Code(Expression(11, Sub)) at (prev + 0, 44) to (start + 0, 51)
+- Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 51)
     = ((c2 + c3) - c4)
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 0, 17)
-    = ((c2 + c3) + ((c1 - c2) - c3))
-- Code(Expression(20, Add)) at (prev + 3, 9) to (start + 0, 10)
-    = (c6 + (c7 + c8))
-- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 19)
-    = ((c2 + c3) + ((c1 - c2) - c3))
-- Branch { true: Counter(5), false: Expression(19, Sub) } at (prev + 0, 14) to (start + 0, 19)
+- Code(Counter(1)) at (prev + 1, 5) to (start + 0, 17)
+- Code(Expression(13, Add)) at (prev + 3, 9) to (start + 0, 10)
+    = ((c6 + c7) + c8)
+- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 19)
+- Branch { true: Counter(5), false: Expression(10, Sub) } at (prev + 0, 14) to (start + 0, 19)
     true  = c5
-    false = (((c2 + c3) + ((c1 - c2) - c3)) - c5)
+    false = (c1 - c5)
 - Code(Counter(5)) at (prev + 0, 23) to (start + 0, 28)
-- Branch { true: Counter(6), false: Expression(18, Sub) } at (prev + 0, 23) to (start + 0, 28)
+- Branch { true: Counter(6), false: Expression(11, Sub) } at (prev + 0, 23) to (start + 0, 28)
     true  = c6
     false = (c5 - c6)
-- Code(Expression(17, Add)) at (prev + 0, 34) to (start + 0, 40)
-    = ((c5 - c6) + (((c2 + c3) + ((c1 - c2) - c3)) - c5))
+- Code(Expression(12, Sub)) at (prev + 0, 34) to (start + 0, 40)
+    = (c1 - c6)
 - Branch { true: Counter(7), false: Counter(8) } at (prev + 0, 34) to (start + 0, 40)
     true  = c7
     false = c8
 - Code(Counter(7)) at (prev + 0, 44) to (start + 0, 51)
-- Code(Expression(20, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = (c6 + (c7 + c8))
+- Code(Expression(13, Add)) at (prev + 1, 5) to (start + 1, 2)
+    = ((c6 + c7) + c8)
 Highest counter ID seen: c8
 
diff --git a/tests/coverage/branch/match-arms.cov-map b/tests/coverage/branch/match-arms.cov-map
index fd0366ee818..a93df9814ee 100644
--- a/tests/coverage/branch/match-arms.cov-map
+++ b/tests/coverage/branch/match-arms.cov-map
@@ -1,12 +1,12 @@
 Function name: match_arms::guards
-Raw bytes (88): 0x[01, 01, 08, 07, 15, 0b, 11, 0f, 0d, 00, 09, 17, 25, 1b, 21, 1f, 1d, 03, 19, 0c, 01, 30, 01, 01, 10, 29, 03, 0b, 00, 10, 19, 01, 11, 00, 29, 20, 19, 09, 00, 17, 00, 1b, 1d, 01, 11, 00, 29, 20, 1d, 0d, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 11, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 15, 00, 17, 00, 1b, 03, 01, 0e, 00, 18, 13, 03, 05, 01, 02]
+Raw bytes (88): 0x[01, 01, 08, 07, 00, 0b, 11, 0f, 0d, 05, 09, 17, 25, 1b, 21, 1f, 1d, 03, 19, 0c, 01, 30, 01, 01, 10, 29, 03, 0b, 00, 10, 19, 01, 11, 00, 29, 20, 19, 05, 00, 17, 00, 1b, 1d, 01, 11, 00, 29, 20, 1d, 09, 00, 17, 00, 1b, 21, 01, 11, 00, 29, 20, 21, 0d, 00, 17, 00, 1b, 25, 01, 11, 00, 29, 20, 25, 11, 00, 17, 00, 1b, 03, 01, 0e, 00, 18, 13, 03, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 8
-- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(5)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Zero
 - expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4)
 - expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Zero, rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 4 operands: lhs = Expression(5, Add), rhs = Counter(9)
 - expression 5 operands: lhs = Expression(6, Add), rhs = Counter(8)
 - expression 6 operands: lhs = Expression(7, Add), rhs = Counter(7)
@@ -15,81 +15,67 @@ Number of file 0 mappings: 12
 - Code(Counter(0)) at (prev + 48, 1) to (start + 1, 16)
 - Code(Counter(10)) at (prev + 3, 11) to (start + 0, 16)
 - Code(Counter(6)) at (prev + 1, 17) to (start + 0, 41)
-- Branch { true: Counter(6), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27)
+- Branch { true: Counter(6), false: Counter(1) } at (prev + 0, 23) to (start + 0, 27)
     true  = c6
-    false = c2
+    false = c1
 - Code(Counter(7)) at (prev + 1, 17) to (start + 0, 41)
-- Branch { true: Counter(7), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27)
+- Branch { true: Counter(7), false: Counter(2) } at (prev + 0, 23) to (start + 0, 27)
     true  = c7
-    false = c3
+    false = c2
 - Code(Counter(8)) at (prev + 1, 17) to (start + 0, 41)
-- Branch { true: Counter(8), false: Counter(4) } at (prev + 0, 23) to (start + 0, 27)
+- Branch { true: Counter(8), false: Counter(3) } at (prev + 0, 23) to (start + 0, 27)
     true  = c8
-    false = c4
+    false = c3
 - Code(Counter(9)) at (prev + 1, 17) to (start + 0, 41)
-- Branch { true: Counter(9), false: Counter(5) } at (prev + 0, 23) to (start + 0, 27)
+- Branch { true: Counter(9), false: Counter(4) } at (prev + 0, 23) to (start + 0, 27)
     true  = c9
-    false = c5
+    false = c4
 - Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 24)
-    = ((((Zero + c2) + c3) + c4) + c5)
+    = ((((c1 + c2) + c3) + c4) + Zero)
 - Code(Expression(4, Add)) at (prev + 3, 5) to (start + 1, 2)
-    = ((((((((Zero + c2) + c3) + c4) + c5) + c6) + c7) + c8) + c9)
+    = ((((((((c1 + c2) + c3) + c4) + Zero) + c6) + c7) + c8) + c9)
 Highest counter ID seen: c10
 
 Function name: match_arms::match_arms
-Raw bytes (51): 0x[01, 01, 06, 05, 07, 0b, 11, 09, 0d, 13, 02, 17, 09, 11, 0d, 07, 01, 18, 01, 01, 10, 05, 03, 0b, 00, 10, 11, 01, 11, 00, 21, 0d, 01, 11, 00, 21, 09, 01, 11, 00, 21, 02, 01, 11, 00, 21, 0f, 03, 05, 01, 02]
+Raw bytes (45): 0x[01, 01, 03, 05, 07, 0b, 11, 09, 0d, 07, 01, 18, 01, 01, 10, 05, 03, 0b, 00, 10, 09, 01, 11, 00, 21, 0d, 01, 11, 00, 21, 11, 01, 11, 00, 21, 02, 01, 11, 00, 21, 05, 03, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 6
+Number of expressions: 3
 - expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
 - expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4)
 - expression 2 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 3 operands: lhs = Expression(4, Add), rhs = Expression(0, Sub)
-- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(4), rhs = Counter(3)
 Number of file 0 mappings: 7
 - Code(Counter(0)) at (prev + 24, 1) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 3, 11) to (start + 0, 16)
-- Code(Counter(4)) at (prev + 1, 17) to (start + 0, 33)
-- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 33)
 - Code(Counter(2)) at (prev + 1, 17) to (start + 0, 33)
+- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 33)
+- Code(Counter(4)) at (prev + 1, 17) to (start + 0, 33)
 - Code(Expression(0, Sub)) at (prev + 1, 17) to (start + 0, 33)
     = (c1 - ((c2 + c3) + c4))
-- Code(Expression(3, Add)) at (prev + 3, 5) to (start + 1, 2)
-    = (((c4 + c3) + c2) + (c1 - ((c2 + c3) + c4)))
+- Code(Counter(1)) at (prev + 3, 5) to (start + 1, 2)
 Highest counter ID seen: c4
 
 Function name: match_arms::or_patterns
-Raw bytes (75): 0x[01, 01, 0d, 11, 0d, 05, 2f, 33, 11, 09, 0d, 09, 2a, 05, 2f, 33, 11, 09, 0d, 03, 27, 09, 2a, 05, 2f, 33, 11, 09, 0d, 09, 01, 25, 01, 01, 10, 05, 03, 0b, 00, 10, 11, 01, 11, 00, 12, 0d, 00, 1e, 00, 1f, 03, 00, 24, 00, 2e, 09, 01, 11, 00, 12, 2a, 00, 1e, 00, 1f, 27, 00, 24, 00, 2e, 23, 03, 05, 01, 02]
+Raw bytes (57): 0x[01, 01, 04, 09, 0d, 05, 0b, 03, 11, 05, 03, 09, 01, 25, 01, 01, 10, 05, 03, 0b, 00, 10, 09, 01, 11, 00, 12, 0d, 00, 1e, 00, 1f, 03, 00, 24, 00, 2e, 11, 01, 11, 00, 12, 06, 00, 1e, 00, 1f, 0e, 00, 24, 00, 2e, 05, 03, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 13
-- expression 0 operands: lhs = Counter(4), rhs = Counter(3)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(11, Add)
-- expression 2 operands: lhs = Expression(12, Add), rhs = Counter(4)
-- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 4 operands: lhs = Counter(2), rhs = Expression(10, Sub)
-- expression 5 operands: lhs = Counter(1), rhs = Expression(11, Add)
-- expression 6 operands: lhs = Expression(12, Add), rhs = Counter(4)
-- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 8 operands: lhs = Expression(0, Add), rhs = Expression(9, Add)
-- expression 9 operands: lhs = Counter(2), rhs = Expression(10, Sub)
-- expression 10 operands: lhs = Counter(1), rhs = Expression(11, Add)
-- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(4)
-- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
+Number of expressions: 4
+- expression 0 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Add)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 37, 1) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 3, 11) to (start + 0, 16)
-- Code(Counter(4)) at (prev + 1, 17) to (start + 0, 18)
+- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 18)
 - Code(Counter(3)) at (prev + 0, 30) to (start + 0, 31)
 - Code(Expression(0, Add)) at (prev + 0, 36) to (start + 0, 46)
-    = (c4 + c3)
-- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 18)
-- Code(Expression(10, Sub)) at (prev + 0, 30) to (start + 0, 31)
+    = (c2 + c3)
+- Code(Counter(4)) at (prev + 1, 17) to (start + 0, 18)
+- Code(Expression(1, Sub)) at (prev + 0, 30) to (start + 0, 31)
     = (c1 - ((c2 + c3) + c4))
-- Code(Expression(9, Add)) at (prev + 0, 36) to (start + 0, 46)
-    = (c2 + (c1 - ((c2 + c3) + c4)))
-- Code(Expression(8, Add)) at (prev + 3, 5) to (start + 1, 2)
-    = ((c4 + c3) + (c2 + (c1 - ((c2 + c3) + c4))))
+- Code(Expression(3, Sub)) at (prev + 0, 36) to (start + 0, 46)
+    = (c1 - (c2 + c3))
+- Code(Counter(1)) at (prev + 3, 5) to (start + 1, 2)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/branch/no-mir-spans.cov-map b/tests/coverage/branch/no-mir-spans.cov-map
index ab12732b1ed..6003efc36ca 100644
--- a/tests/coverage/branch/no-mir-spans.cov-map
+++ b/tests/coverage/branch/no-mir-spans.cov-map
@@ -23,19 +23,19 @@ Number of file 0 mappings: 2
 Highest counter ID seen: c2
 
 Function name: no_mir_spans::while_op_and
-Raw bytes (25): 0x[01, 01, 01, 09, 0d, 03, 01, 22, 01, 00, 13, 20, 09, 05, 05, 0b, 00, 10, 20, 02, 0d, 00, 14, 00, 19]
+Raw bytes (25): 0x[01, 01, 01, 05, 09, 03, 01, 22, 01, 00, 13, 20, 05, 0d, 05, 0b, 00, 10, 20, 02, 09, 00, 14, 00, 19]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 1
-- expression 0 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 3
 - Code(Counter(0)) at (prev + 34, 1) to (start + 0, 19)
-- Branch { true: Counter(2), false: Counter(1) } at (prev + 5, 11) to (start + 0, 16)
-    true  = c2
-    false = c1
-- Branch { true: Expression(0, Sub), false: Counter(3) } at (prev + 0, 20) to (start + 0, 25)
-    true  = (c2 - c3)
+- Branch { true: Counter(1), false: Counter(3) } at (prev + 5, 11) to (start + 0, 16)
+    true  = c1
     false = c3
+- Branch { true: Expression(0, Sub), false: Counter(2) } at (prev + 0, 20) to (start + 0, 25)
+    true  = (c1 - c2)
+    false = c2
 Highest counter ID seen: c3
 
 Function name: no_mir_spans::while_op_or
diff --git a/tests/coverage/branch/while.cov-map b/tests/coverage/branch/while.cov-map
index d5840a2c320..305f6bc74d8 100644
--- a/tests/coverage/branch/while.cov-map
+++ b/tests/coverage/branch/while.cov-map
@@ -35,14 +35,14 @@ Number of file 0 mappings: 6
 Highest counter ID seen: c2
 
 Function name: while::while_op_and
-Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 11, 0d, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 11, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 0f, 04, 01, 00, 02]
+Raw bytes (56): 0x[01, 01, 04, 05, 09, 03, 0d, 03, 0d, 0d, 11, 08, 01, 1e, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 0a, 0d, 00, 0b, 00, 10, 0a, 00, 14, 00, 19, 20, 09, 11, 00, 14, 00, 19, 09, 00, 1a, 03, 06, 0f, 04, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 4
 - expression 0 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(3)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(4), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 30, 1) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 3, 9) to (start + 1, 18)
@@ -58,39 +58,34 @@ Number of file 0 mappings: 8
     false = c4
 - Code(Counter(2)) at (prev + 0, 26) to (start + 3, 6)
 - Code(Expression(3, Add)) at (prev + 4, 1) to (start + 0, 2)
-    = (c4 + c3)
+    = (c3 + c4)
 Highest counter ID seen: c4
 
 Function name: while::while_op_or
-Raw bytes (66): 0x[01, 01, 09, 05, 1b, 09, 0d, 03, 09, 03, 09, 22, 0d, 03, 09, 09, 0d, 22, 0d, 03, 09, 08, 01, 29, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 09, 22, 00, 0b, 00, 10, 22, 00, 14, 00, 19, 20, 0d, 1e, 00, 14, 00, 19, 1b, 00, 1a, 03, 06, 1e, 04, 01, 00, 02]
+Raw bytes (58): 0x[01, 01, 05, 07, 0d, 05, 09, 05, 0d, 05, 0d, 09, 0d, 08, 01, 29, 01, 01, 10, 05, 03, 09, 01, 12, 03, 02, 0b, 00, 10, 20, 09, 0f, 00, 0b, 00, 10, 0f, 00, 14, 00, 19, 20, 0d, 05, 00, 14, 00, 19, 13, 00, 1a, 03, 06, 05, 04, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 9
-- expression 0 operands: lhs = Counter(1), rhs = Expression(6, Add)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(2)
-- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(8, Sub), rhs = Counter(3)
-- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(3)
-- expression 8 operands: lhs = Expression(0, Add), rhs = Counter(2)
+Number of expressions: 5
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 41, 1) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 3, 9) to (start + 1, 18)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 16)
-    = (c1 + (c2 + c3))
-- Branch { true: Counter(2), false: Expression(8, Sub) } at (prev + 0, 11) to (start + 0, 16)
+    = ((c1 + c2) + c3)
+- Branch { true: Counter(2), false: Expression(3, Add) } at (prev + 0, 11) to (start + 0, 16)
     true  = c2
-    false = ((c1 + (c2 + c3)) - c2)
-- Code(Expression(8, Sub)) at (prev + 0, 20) to (start + 0, 25)
-    = ((c1 + (c2 + c3)) - c2)
-- Branch { true: Counter(3), false: Expression(7, Sub) } at (prev + 0, 20) to (start + 0, 25)
+    false = (c1 + c3)
+- Code(Expression(3, Add)) at (prev + 0, 20) to (start + 0, 25)
+    = (c1 + c3)
+- Branch { true: Counter(3), false: Counter(1) } at (prev + 0, 20) to (start + 0, 25)
     true  = c3
-    false = (((c1 + (c2 + c3)) - c2) - c3)
-- Code(Expression(6, Add)) at (prev + 0, 26) to (start + 3, 6)
+    false = c1
+- Code(Expression(4, Add)) at (prev + 0, 26) to (start + 3, 6)
     = (c2 + c3)
-- Code(Expression(7, Sub)) at (prev + 4, 1) to (start + 0, 2)
-    = (((c1 + (c2 + c3)) - c2) - c3)
+- Code(Counter(1)) at (prev + 4, 1) to (start + 0, 2)
 Highest counter ID seen: c3
 
diff --git a/tests/coverage/closure_macro.cov-map b/tests/coverage/closure_macro.cov-map
index 7c9d3292f98..aedb924eca8 100644
--- a/tests/coverage/closure_macro.cov-map
+++ b/tests/coverage/closure_macro.cov-map
@@ -25,13 +25,13 @@ Number of file 0 mappings: 6
 Highest counter ID seen: c1
 
 Function name: closure_macro::main::{closure#0}
-Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 0b, 09, 0d, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a]
+Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 10, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 3
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 5
 - Code(Counter(0)) at (prev + 16, 28) to (start + 3, 33)
 - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39)
@@ -39,6 +39,6 @@ Number of file 0 mappings: 5
     = (c0 - c1)
 - Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30)
 - Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10)
-    = (c1 + (c2 + c3))
+    = ((c1 + c2) + c3)
 Highest counter ID seen: c3
 
diff --git a/tests/coverage/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map
index e2a52e57015..5b99889514c 100644
--- a/tests/coverage/closure_macro_async.cov-map
+++ b/tests/coverage/closure_macro_async.cov-map
@@ -34,13 +34,13 @@ Number of file 0 mappings: 6
 Highest counter ID seen: c1
 
 Function name: closure_macro_async::test::{closure#0}::{closure#0}
-Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 0b, 09, 0d, 05, 01, 15, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a]
+Raw bytes (35): 0x[01, 01, 03, 01, 05, 0b, 0d, 05, 09, 05, 01, 15, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 0d, 00, 17, 00, 1e, 07, 02, 09, 00, 0a]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 3
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 5
 - Code(Counter(0)) at (prev + 21, 28) to (start + 3, 33)
 - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39)
@@ -48,6 +48,6 @@ Number of file 0 mappings: 5
     = (c0 - c1)
 - Code(Counter(3)) at (prev + 0, 23) to (start + 0, 30)
 - Code(Expression(1, Add)) at (prev + 2, 9) to (start + 0, 10)
-    = (c1 + (c2 + c3))
+    = ((c1 + c2) + c3)
 Highest counter ID seen: c3
 
diff --git a/tests/coverage/condition/conditions.cov-map b/tests/coverage/condition/conditions.cov-map
index 208d671919c..72f39b88c6a 100644
--- a/tests/coverage/condition/conditions.cov-map
+++ b/tests/coverage/condition/conditions.cov-map
@@ -1,29 +1,27 @@
 Function name: conditions::assign_3_and_or
-Raw bytes (69): 0x[01, 01, 07, 07, 11, 09, 0d, 01, 05, 05, 09, 16, 1a, 05, 09, 01, 05, 09, 01, 1c, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 1a, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 16, 00, 12, 00, 13, 13, 00, 17, 00, 18, 20, 0d, 11, 00, 17, 00, 18, 03, 01, 05, 01, 02]
+Raw bytes (65): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 09, 01, 1c, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0a, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0e, 00, 12, 00, 13, 12, 00, 17, 00, 18, 20, 0d, 11, 00, 17, 00, 18, 03, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 7
+Number of expressions: 5
 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4)
 - expression 1 operands: lhs = Counter(2), rhs = Counter(3)
 - expression 2 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 3 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Expression(6, Sub)
-- expression 5 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 28, 1) to (start + 0, 47)
 - Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
     = ((c2 + c3) + c4)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
-- Branch { true: Counter(1), false: Expression(6, Sub) } at (prev + 0, 13) to (start + 0, 14)
+- Branch { true: Counter(1), false: Expression(2, Sub) } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
-- Branch { true: Counter(2), false: Expression(5, Sub) } at (prev + 0, 18) to (start + 0, 19)
+- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 18) to (start + 0, 19)
     true  = c2
     false = (c1 - c2)
-- Code(Expression(4, Add)) at (prev + 0, 23) to (start + 0, 24)
-    = ((c1 - c2) + (c0 - c1))
+- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24)
+    = (c0 - c2)
 - Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 23) to (start + 0, 24)
     true  = c3
     false = c4
@@ -32,54 +30,54 @@ Number of file 0 mappings: 9
 Highest counter ID seen: c4
 
 Function name: conditions::assign_3_or_and
-Raw bytes (73): 0x[01, 01, 09, 05, 07, 0b, 11, 09, 0d, 01, 05, 01, 05, 22, 11, 01, 05, 22, 11, 01, 05, 09, 01, 17, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 22, 00, 0d, 00, 0e, 22, 00, 12, 00, 13, 20, 1e, 11, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 20, 09, 0d, 00, 17, 00, 18, 03, 01, 05, 01, 02]
+Raw bytes (73): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 09, 01, 17, 01, 00, 2f, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 12, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 20, 1e, 11, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 20, 09, 0d, 00, 17, 00, 18, 03, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 9
-- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 3 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 4 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 5 operands: lhs = Expression(8, Sub), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(4)
-- expression 8 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add)
+- expression 6 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(4)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 47)
 - Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
-    = (c1 + ((c2 + c3) + c4))
+    = (((c1 + c2) + c3) + c4)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
-- Branch { true: Counter(1), false: Expression(8, Sub) } at (prev + 0, 13) to (start + 0, 14)
+- Branch { true: Counter(1), false: Expression(4, Sub) } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
     false = (c0 - c1)
-- Code(Expression(8, Sub)) at (prev + 0, 18) to (start + 0, 19)
+- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19)
     = (c0 - c1)
 - Branch { true: Expression(7, Sub), false: Counter(4) } at (prev + 0, 18) to (start + 0, 19)
-    true  = ((c0 - c1) - c4)
+    true  = (c0 - (c1 + c4))
     false = c4
 - Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24)
-    = ((c0 - c1) - c4)
+    = (c0 - (c1 + c4))
 - Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 23) to (start + 0, 24)
     true  = c2
     false = c3
 - Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = (c1 + ((c2 + c3) + c4))
+    = (((c1 + c2) + c3) + c4)
 Highest counter ID seen: c4
 
 Function name: conditions::assign_and
-Raw bytes (51): 0x[01, 01, 04, 07, 0e, 09, 0d, 01, 05, 01, 05, 07, 01, 0d, 01, 00, 21, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 03, 01, 05, 01, 02]
+Raw bytes (51): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 07, 01, 0d, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 02, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 4
-- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(3, Sub)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(2)
 - expression 3 operands: lhs = Counter(0), rhs = Counter(1)
 Number of file 0 mappings: 7
 - Code(Counter(0)) at (prev + 13, 1) to (start + 0, 33)
-- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10)
+    = (((c0 + c2) + c3) - c1)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
 - Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
@@ -88,8 +86,8 @@ Number of file 0 mappings: 7
 - Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19)
     true  = c2
     false = c3
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: conditions::assign_or
@@ -128,13 +126,14 @@ Number of file 0 mappings: 1
 Highest counter ID seen: c0
 
 Function name: conditions::func_call
-Raw bytes (39): 0x[01, 01, 03, 01, 05, 0b, 02, 09, 0d, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 0d, 00, 0e, 00, 0f, 07, 01, 01, 00, 02]
+Raw bytes (41): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 05, 01, 25, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 0d, 00, 0e, 00, 0f, 06, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 3
+Number of expressions: 4
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 5
 - Code(Counter(0)) at (prev + 37, 1) to (start + 1, 10)
 - Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 1, 9) to (start + 0, 10)
@@ -144,8 +143,8 @@ Number of file 0 mappings: 5
 - Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 14) to (start + 0, 15)
     true  = c2
     false = c3
-- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: conditions::simple_assign
diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map
index 938e4404013..21b2ec9a19e 100644
--- a/tests/coverage/conditions.cov-map
+++ b/tests/coverage/conditions.cov-map
@@ -1,264 +1,294 @@
 Function name: conditions::main
-Raw bytes (799): 0x[01, 01, 94, 01, 09, 2b, 2f, 41, 33, 3d, 35, 39, 01, 09, 0d, 35, 1e, 39, 0d, 35, 33, 3d, 35, 39, 2f, 41, 33, 3d, 35, 39, ce, 04, 0d, 01, 09, 03, 49, 62, 31, 03, 49, 5e, 4d, 62, 31, 03, 49, 5a, 51, 5e, 4d, 62, 31, 03, 49, 87, 01, 55, 4d, 51, 83, 01, 59, 87, 01, 55, 4d, 51, 49, 7f, 83, 01, 59, 87, 01, 55, 4d, 51, 5d, 65, ae, 01, 2d, 5d, 65, aa, 01, 69, ae, 01, 2d, 5d, 65, a6, 01, 6d, aa, 01, 69, ae, 01, 2d, 5d, 65, f3, 02, 71, 69, 6d, ef, 02, 75, f3, 02, 71, 69, 6d, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, e3, 02, 7d, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, de, 02, 29, e3, 02, 7d, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, da, 02, 81, 01, de, 02, 29, e3, 02, 7d, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, d6, 02, 85, 01, da, 02, 81, 01, de, 02, 29, e3, 02, 7d, e7, 02, 00, 65, eb, 02, ef, 02, 75, f3, 02, 71, 69, 6d, 8f, 04, 89, 01, 81, 01, 85, 01, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, 11, af, 04, b3, 04, 21, b7, 04, 1d, 15, 19, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, 83, 04, 11, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, fe, 03, 25, 83, 04, 11, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, fa, 03, 15, fe, 03, 25, 83, 04, 11, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, f6, 03, 19, fa, 03, 15, fe, 03, 25, 83, 04, 11, 7d, 87, 04, 8b, 04, 8d, 01, 8f, 04, 89, 01, 81, 01, 85, 01, b7, 04, 1d, 15, 19, b3, 04, 21, b7, 04, 1d, 15, 19, ab, 04, bb, 04, 11, af, 04, b3, 04, 21, b7, 04, 1d, 15, 19, bf, 04, ca, 04, c3, 04, 31, c7, 04, 2d, 25, 29, ce, 04, 0d, 01, 09, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, ce, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 1e, 00, 1d, 00, 2a, 1a, 00, 2e, 00, 3c, 2f, 00, 3d, 02, 0a, 41, 02, 09, 00, 0a, 2b, 01, 09, 01, 12, ca, 04, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 49, 00, 16, 02, 06, 62, 02, 0f, 00, 1c, 5e, 01, 0c, 00, 19, 5a, 00, 1d, 00, 2a, 56, 00, 2e, 00, 3c, 83, 01, 00, 3d, 02, 0a, 59, 02, 09, 00, 0a, 7f, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 7b, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 5d, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, ae, 01, 04, 11, 00, 1e, aa, 01, 01, 10, 00, 1d, a6, 01, 00, 21, 00, 2e, a2, 01, 00, 32, 00, 40, ef, 02, 00, 41, 02, 0e, 75, 02, 0d, 00, 0e, eb, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 05, 00, 06, e3, 02, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 83, 04, 02, 09, 00, 0a, e3, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, de, 02, 02, 0f, 00, 1c, da, 02, 01, 0c, 00, 19, d6, 02, 00, 1d, 00, 2a, d2, 02, 00, 2e, 00, 3c, 8b, 04, 00, 3d, 02, 0a, 8d, 01, 02, 09, 00, 0a, 87, 04, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, ab, 04, 05, 09, 00, 0a, 83, 04, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, fe, 03, 02, 0f, 00, 1c, fa, 03, 01, 0c, 00, 19, f6, 03, 00, 1d, 00, 2a, f2, 03, 00, 2e, 00, 3c, b3, 04, 00, 3d, 02, 0a, 21, 02, 09, 00, 0a, af, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, a7, 04, 02, 01, 00, 02]
+Raw bytes (873): 0x[01, 01, b2, 01, 07, 19, 0b, 15, 0f, 11, 09, 0d, 01, 09, 8d, 01, 0d, 8d, 01, 33, 0d, 11, 33, 15, 0d, 11, 2f, 19, 33, 15, 0d, 11, 01, c7, 05, 09, 8d, 01, 03, 21, 03, 47, 21, 89, 01, 03, 4f, db, 03, 89, 01, 21, 25, 03, 5b, d7, 03, 89, 01, db, 03, 29, 21, 25, 77, 2d, 25, 29, 73, 31, 77, 2d, 25, 29, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 3d, 35, 93, 01, 3d, 85, 01, 35, 9b, 01, af, 01, 85, 01, 3d, 41, 35, a7, 01, ab, 01, 85, 01, af, 01, 45, 3d, 41, c3, 01, 49, 41, 45, bf, 01, 4d, c3, 01, 49, 41, 45, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, bb, 03, 35, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, bb, 03, eb, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, 35, 55, bb, 03, fb, 02, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, eb, 03, 81, 01, 35, 55, bb, 03, ab, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e7, 03, 81, 01, eb, 03, 59, 35, 55, bb, 03, df, 03, bf, 03, 4d, c3, 03, 49, c7, 03, 45, cb, 03, 41, cf, 03, 3d, d3, 03, 31, d7, 03, 2d, db, 03, 29, 21, 25, e3, 03, 81, 01, e7, 03, 5d, eb, 03, 59, 35, 55, ff, 03, 61, 59, 5d, fb, 03, 65, ff, 03, 61, 59, 5d, 87, 04, 79, 83, 05, 75, 87, 05, 71, 69, 6d, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, 69, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, ef, 04, cb, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 69, 7d, ef, 04, e3, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 87, 05, 7d, 69, 6d, ef, 04, ff, 04, f3, 04, 65, f7, 04, 61, fb, 04, 5d, 55, 59, 83, 05, 7d, 87, 05, 71, 69, 6d, 9b, 05, 75, 6d, 71, 97, 05, 79, 9b, 05, 75, 6d, 71, a3, 05, c7, 05, a7, 05, 89, 01, ab, 05, 85, 01, af, 05, 81, 01, b3, 05, 7d, b7, 05, 79, bb, 05, 75, bf, 05, 71, c3, 05, 6d, 01, 69, 09, 8d, 01, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 12, 02, 0f, 00, 1c, 8d, 01, 01, 0c, 00, 19, 16, 00, 1d, 00, 2a, 1a, 00, 2e, 00, 3c, 2f, 00, 3d, 02, 0a, 19, 02, 09, 00, 0a, 2b, 01, 09, 01, 12, 36, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 1d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 21, 00, 16, 02, 06, 3e, 02, 0f, 00, 1c, 42, 01, 0c, 00, 19, 4a, 00, 1d, 00, 2a, 56, 00, 2e, 00, 3c, 73, 00, 3d, 02, 0a, 31, 02, 09, 00, 0a, 6f, 01, 09, 00, 17, 89, 01, 02, 09, 00, 0f, cf, 03, 03, 08, 00, 0c, 35, 01, 0d, 01, 10, 39, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 35, 02, 0c, 00, 19, 3d, 00, 1a, 02, 0a, 8a, 01, 04, 11, 00, 1e, 8e, 01, 01, 10, 00, 1d, 96, 01, 00, 21, 00, 2e, a2, 01, 00, 32, 00, 40, bf, 01, 00, 41, 02, 0e, 4d, 02, 0d, 00, 0e, bb, 01, 01, 0d, 00, 1b, 85, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, fe, 01, 02, 09, 01, 0c, 51, 01, 0d, 02, 06, 00, 02, 05, 00, 06, ef, 04, 02, 09, 00, 0a, fe, 01, 00, 10, 00, 1d, 55, 00, 1e, 02, 06, a6, 02, 02, 0f, 00, 1c, d2, 02, 01, 0c, 00, 19, 82, 03, 00, 1d, 00, 2a, b6, 03, 00, 2e, 00, 3c, fb, 03, 00, 3d, 02, 0a, 65, 02, 09, 00, 0a, f7, 03, 01, 09, 00, 17, 81, 01, 02, 0d, 02, 0f, 83, 04, 05, 09, 00, 0a, ef, 04, 00, 10, 00, 1d, 69, 00, 1e, 02, 06, a2, 04, 02, 0f, 00, 1c, b6, 04, 01, 0c, 00, 19, ce, 04, 00, 1d, 00, 2a, ea, 04, 00, 2e, 00, 3c, 97, 05, 00, 3d, 02, 0a, 79, 02, 09, 00, 0a, 93, 05, 01, 09, 00, 17, 7d, 02, 09, 00, 0f, 9e, 05, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 148
-- expression 0 operands: lhs = Counter(2), rhs = Expression(10, Add)
-- expression 1 operands: lhs = Expression(11, Add), rhs = Counter(16)
-- expression 2 operands: lhs = Expression(12, Add), rhs = Counter(15)
-- expression 3 operands: lhs = Counter(13), rhs = Counter(14)
+Number of expressions: 178
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(6)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(5)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(4)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
 - expression 4 operands: lhs = Counter(0), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(3), rhs = Counter(13)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(14)
-- expression 7 operands: lhs = Counter(3), rhs = Counter(13)
-- expression 8 operands: lhs = Expression(12, Add), rhs = Counter(15)
-- expression 9 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(16)
-- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(15)
-- expression 12 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 13 operands: lhs = Expression(147, Sub), rhs = Counter(3)
-- expression 14 operands: lhs = Counter(0), rhs = Counter(2)
-- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(18)
-- expression 16 operands: lhs = Expression(24, Sub), rhs = Counter(12)
-- expression 17 operands: lhs = Expression(0, Add), rhs = Counter(18)
-- expression 18 operands: lhs = Expression(23, Sub), rhs = Counter(19)
-- expression 19 operands: lhs = Expression(24, Sub), rhs = Counter(12)
-- expression 20 operands: lhs = Expression(0, Add), rhs = Counter(18)
-- expression 21 operands: lhs = Expression(22, Sub), rhs = Counter(20)
-- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(19)
-- expression 23 operands: lhs = Expression(24, Sub), rhs = Counter(12)
-- expression 24 operands: lhs = Expression(0, Add), rhs = Counter(18)
-- expression 25 operands: lhs = Expression(33, Add), rhs = Counter(21)
-- expression 26 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 27 operands: lhs = Expression(32, Add), rhs = Counter(22)
-- expression 28 operands: lhs = Expression(33, Add), rhs = Counter(21)
-- expression 29 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 30 operands: lhs = Counter(18), rhs = Expression(31, Add)
-- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(22)
-- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(21)
-- expression 33 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 34 operands: lhs = Counter(23), rhs = Counter(25)
-- expression 35 operands: lhs = Expression(43, Sub), rhs = Counter(11)
-- expression 36 operands: lhs = Counter(23), rhs = Counter(25)
-- expression 37 operands: lhs = Expression(42, Sub), rhs = Counter(26)
-- expression 38 operands: lhs = Expression(43, Sub), rhs = Counter(11)
-- expression 39 operands: lhs = Counter(23), rhs = Counter(25)
-- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(27)
-- expression 41 operands: lhs = Expression(42, Sub), rhs = Counter(26)
-- expression 42 operands: lhs = Expression(43, Sub), rhs = Counter(11)
-- expression 43 operands: lhs = Counter(23), rhs = Counter(25)
-- expression 44 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 45 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 46 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 47 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 48 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 49 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 50 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 51 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 52 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 53 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 54 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 55 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 56 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 57 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 58 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 59 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 60 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 61 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 62 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 63 operands: lhs = Expression(88, Add), rhs = Counter(31)
-- expression 64 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 65 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 66 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 67 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 68 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 69 operands: lhs = Expression(87, Sub), rhs = Counter(10)
-- expression 70 operands: lhs = Expression(88, Add), rhs = Counter(31)
-- expression 71 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 72 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 73 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 74 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 75 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 76 operands: lhs = Expression(86, Sub), rhs = Counter(32)
-- expression 77 operands: lhs = Expression(87, Sub), rhs = Counter(10)
-- expression 78 operands: lhs = Expression(88, Add), rhs = Counter(31)
-- expression 79 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 80 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 81 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 82 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 83 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 84 operands: lhs = Expression(85, Sub), rhs = Counter(33)
-- expression 85 operands: lhs = Expression(86, Sub), rhs = Counter(32)
-- expression 86 operands: lhs = Expression(87, Sub), rhs = Counter(10)
-- expression 87 operands: lhs = Expression(88, Add), rhs = Counter(31)
-- expression 88 operands: lhs = Expression(89, Add), rhs = Zero
-- expression 89 operands: lhs = Counter(25), rhs = Expression(90, Add)
-- expression 90 operands: lhs = Expression(91, Add), rhs = Counter(29)
-- expression 91 operands: lhs = Expression(92, Add), rhs = Counter(28)
-- expression 92 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 93 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 94 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 95 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 96 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 97 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 98 operands: lhs = Counter(4), rhs = Expression(139, Add)
-- expression 99 operands: lhs = Expression(140, Add), rhs = Counter(8)
-- expression 100 operands: lhs = Expression(141, Add), rhs = Counter(7)
-- expression 101 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 102 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 103 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 104 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 105 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 106 operands: lhs = Expression(128, Add), rhs = Counter(4)
-- expression 107 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 108 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 109 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 110 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 111 operands: lhs = Expression(127, Sub), rhs = Counter(9)
-- expression 112 operands: lhs = Expression(128, Add), rhs = Counter(4)
-- expression 113 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 114 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 115 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 116 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 117 operands: lhs = Expression(126, Sub), rhs = Counter(5)
-- expression 118 operands: lhs = Expression(127, Sub), rhs = Counter(9)
-- expression 119 operands: lhs = Expression(128, Add), rhs = Counter(4)
-- expression 120 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 121 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 122 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 123 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 124 operands: lhs = Expression(125, Sub), rhs = Counter(6)
-- expression 125 operands: lhs = Expression(126, Sub), rhs = Counter(5)
-- expression 126 operands: lhs = Expression(127, Sub), rhs = Counter(9)
-- expression 127 operands: lhs = Expression(128, Add), rhs = Counter(4)
-- expression 128 operands: lhs = Counter(31), rhs = Expression(129, Add)
-- expression 129 operands: lhs = Expression(130, Add), rhs = Counter(35)
-- expression 130 operands: lhs = Expression(131, Add), rhs = Counter(34)
-- expression 131 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 132 operands: lhs = Expression(141, Add), rhs = Counter(7)
-- expression 133 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 134 operands: lhs = Expression(140, Add), rhs = Counter(8)
-- expression 135 operands: lhs = Expression(141, Add), rhs = Counter(7)
-- expression 136 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 137 operands: lhs = Expression(138, Add), rhs = Expression(142, Add)
-- expression 138 operands: lhs = Counter(4), rhs = Expression(139, Add)
-- expression 139 operands: lhs = Expression(140, Add), rhs = Counter(8)
-- expression 140 operands: lhs = Expression(141, Add), rhs = Counter(7)
-- expression 141 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 142 operands: lhs = Expression(143, Add), rhs = Expression(146, Sub)
-- expression 143 operands: lhs = Expression(144, Add), rhs = Counter(12)
-- expression 144 operands: lhs = Expression(145, Add), rhs = Counter(11)
-- expression 145 operands: lhs = Counter(9), rhs = Counter(10)
-- expression 146 operands: lhs = Expression(147, Sub), rhs = Counter(3)
-- expression 147 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 5 operands: lhs = Counter(35), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(35), rhs = Expression(12, Add)
+- expression 7 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 8 operands: lhs = Expression(12, Add), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(6)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 13 operands: lhs = Counter(0), rhs = Expression(177, Add)
+- expression 14 operands: lhs = Counter(2), rhs = Counter(35)
+- expression 15 operands: lhs = Expression(0, Add), rhs = Counter(8)
+- expression 16 operands: lhs = Expression(0, Add), rhs = Expression(17, Add)
+- expression 17 operands: lhs = Counter(8), rhs = Counter(34)
+- expression 18 operands: lhs = Expression(0, Add), rhs = Expression(19, Add)
+- expression 19 operands: lhs = Expression(118, Add), rhs = Counter(34)
+- expression 20 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 21 operands: lhs = Expression(0, Add), rhs = Expression(22, Add)
+- expression 22 operands: lhs = Expression(117, Add), rhs = Counter(34)
+- expression 23 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 24 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(11)
+- expression 26 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(12)
+- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(11)
+- expression 29 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 30 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 31 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 32 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 33 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 34 operands: lhs = Counter(13), rhs = Counter(15)
+- expression 35 operands: lhs = Counter(13), rhs = Expression(36, Add)
+- expression 36 operands: lhs = Counter(15), rhs = Counter(33)
+- expression 37 operands: lhs = Counter(13), rhs = Expression(38, Add)
+- expression 38 operands: lhs = Expression(43, Add), rhs = Counter(33)
+- expression 39 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 40 operands: lhs = Counter(13), rhs = Expression(41, Add)
+- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(33)
+- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(17)
+- expression 43 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 44 operands: lhs = Expression(48, Add), rhs = Counter(18)
+- expression 45 operands: lhs = Counter(16), rhs = Counter(17)
+- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(19)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(18)
+- expression 48 operands: lhs = Counter(16), rhs = Counter(17)
+- expression 49 operands: lhs = Expression(110, Add), rhs = Counter(13)
+- expression 50 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 51 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 52 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 53 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 54 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 55 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 56 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 57 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 58 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 59 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 60 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 61 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 62 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 63 operands: lhs = Expression(110, Add), rhs = Counter(13)
+- expression 64 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 65 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 66 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 67 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 68 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 69 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 70 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 71 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 72 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 73 operands: lhs = Expression(110, Add), rhs = Expression(122, Add)
+- expression 74 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 75 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 76 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 77 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 78 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 79 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 80 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 81 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 82 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 83 operands: lhs = Counter(13), rhs = Counter(21)
+- expression 84 operands: lhs = Expression(110, Add), rhs = Expression(94, Add)
+- expression 85 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 86 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 87 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 88 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 89 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 90 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 91 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 92 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 93 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 94 operands: lhs = Expression(122, Add), rhs = Counter(32)
+- expression 95 operands: lhs = Counter(13), rhs = Counter(21)
+- expression 96 operands: lhs = Expression(110, Add), rhs = Expression(106, Add)
+- expression 97 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 98 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 99 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 100 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 101 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 102 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 103 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 104 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 105 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 106 operands: lhs = Expression(121, Add), rhs = Counter(32)
+- expression 107 operands: lhs = Expression(122, Add), rhs = Counter(22)
+- expression 108 operands: lhs = Counter(13), rhs = Counter(21)
+- expression 109 operands: lhs = Expression(110, Add), rhs = Expression(119, Add)
+- expression 110 operands: lhs = Expression(111, Add), rhs = Counter(19)
+- expression 111 operands: lhs = Expression(112, Add), rhs = Counter(18)
+- expression 112 operands: lhs = Expression(113, Add), rhs = Counter(17)
+- expression 113 operands: lhs = Expression(114, Add), rhs = Counter(16)
+- expression 114 operands: lhs = Expression(115, Add), rhs = Counter(15)
+- expression 115 operands: lhs = Expression(116, Add), rhs = Counter(12)
+- expression 116 operands: lhs = Expression(117, Add), rhs = Counter(11)
+- expression 117 operands: lhs = Expression(118, Add), rhs = Counter(10)
+- expression 118 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 119 operands: lhs = Expression(120, Add), rhs = Counter(32)
+- expression 120 operands: lhs = Expression(121, Add), rhs = Counter(23)
+- expression 121 operands: lhs = Expression(122, Add), rhs = Counter(22)
+- expression 122 operands: lhs = Counter(13), rhs = Counter(21)
+- expression 123 operands: lhs = Expression(127, Add), rhs = Counter(24)
+- expression 124 operands: lhs = Counter(22), rhs = Counter(23)
+- expression 125 operands: lhs = Expression(126, Add), rhs = Counter(25)
+- expression 126 operands: lhs = Expression(127, Add), rhs = Counter(24)
+- expression 127 operands: lhs = Counter(22), rhs = Counter(23)
+- expression 128 operands: lhs = Expression(129, Add), rhs = Counter(30)
+- expression 129 operands: lhs = Expression(160, Add), rhs = Counter(29)
+- expression 130 operands: lhs = Expression(161, Add), rhs = Counter(28)
+- expression 131 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 132 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 133 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 134 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 135 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 136 operands: lhs = Expression(155, Add), rhs = Counter(26)
+- expression 137 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 138 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 139 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 140 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 141 operands: lhs = Expression(155, Add), rhs = Expression(146, Add)
+- expression 142 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 143 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 144 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 145 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 146 operands: lhs = Counter(26), rhs = Counter(31)
+- expression 147 operands: lhs = Expression(155, Add), rhs = Expression(152, Add)
+- expression 148 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 149 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 150 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 151 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 152 operands: lhs = Expression(161, Add), rhs = Counter(31)
+- expression 153 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 154 operands: lhs = Expression(155, Add), rhs = Expression(159, Add)
+- expression 155 operands: lhs = Expression(156, Add), rhs = Counter(25)
+- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(24)
+- expression 157 operands: lhs = Expression(158, Add), rhs = Counter(23)
+- expression 158 operands: lhs = Counter(21), rhs = Counter(22)
+- expression 159 operands: lhs = Expression(160, Add), rhs = Counter(31)
+- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(28)
+- expression 161 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 162 operands: lhs = Expression(166, Add), rhs = Counter(29)
+- expression 163 operands: lhs = Counter(27), rhs = Counter(28)
+- expression 164 operands: lhs = Expression(165, Add), rhs = Counter(30)
+- expression 165 operands: lhs = Expression(166, Add), rhs = Counter(29)
+- expression 166 operands: lhs = Counter(27), rhs = Counter(28)
+- expression 167 operands: lhs = Expression(168, Add), rhs = Expression(177, Add)
+- expression 168 operands: lhs = Expression(169, Add), rhs = Counter(34)
+- expression 169 operands: lhs = Expression(170, Add), rhs = Counter(33)
+- expression 170 operands: lhs = Expression(171, Add), rhs = Counter(32)
+- expression 171 operands: lhs = Expression(172, Add), rhs = Counter(31)
+- expression 172 operands: lhs = Expression(173, Add), rhs = Counter(30)
+- expression 173 operands: lhs = Expression(174, Add), rhs = Counter(29)
+- expression 174 operands: lhs = Expression(175, Add), rhs = Counter(28)
+- expression 175 operands: lhs = Expression(176, Add), rhs = Counter(27)
+- expression 176 operands: lhs = Counter(0), rhs = Counter(26)
+- expression 177 operands: lhs = Counter(2), rhs = Counter(35)
 Number of file 0 mappings: 68
 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
 - Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
 - Code(Zero) at (prev + 2, 5) to (start + 0, 6)
 - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10)
-    = (c2 + (((c13 + c14) + c15) + c16))
+    = ((((c2 + c3) + c4) + c5) + c6)
 - Code(Counter(0)) at (prev + 0, 16) to (start + 0, 29)
 - Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10)
-- Code(Expression(147, Sub)) at (prev + 2, 15) to (start + 0, 28)
+- Code(Expression(4, Sub)) at (prev + 2, 15) to (start + 0, 28)
     = (c0 - c2)
-- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25)
-- Code(Expression(7, Sub)) at (prev + 0, 29) to (start + 0, 42)
-    = (c3 - c13)
+- Code(Counter(35)) at (prev + 1, 12) to (start + 0, 25)
+- Code(Expression(5, Sub)) at (prev + 0, 29) to (start + 0, 42)
+    = (c35 - c3)
 - Code(Expression(6, Sub)) at (prev + 0, 46) to (start + 0, 60)
-    = ((c3 - c13) - c14)
+    = (c35 - (c3 + c4))
 - Code(Expression(11, Add)) at (prev + 0, 61) to (start + 2, 10)
-    = ((c13 + c14) + c15)
-- Code(Counter(16)) at (prev + 2, 9) to (start + 0, 10)
+    = ((c3 + c4) + c5)
+- Code(Counter(6)) at (prev + 2, 9) to (start + 0, 10)
 - Code(Expression(10, Add)) at (prev + 1, 9) to (start + 1, 18)
-    = (((c13 + c14) + c15) + c16)
-- Code(Expression(146, Sub)) at (prev + 3, 9) to (start + 0, 15)
-    = ((c0 - c2) - c3)
+    = (((c3 + c4) + c5) + c6)
+- Code(Expression(13, Sub)) at (prev + 3, 9) to (start + 0, 15)
+    = (c0 - (c2 + c35))
 - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12)
-    = (c2 + (((c13 + c14) + c15) + c16))
-- Code(Counter(17)) at (prev + 1, 13) to (start + 2, 6)
+    = ((((c2 + c3) + c4) + c5) + c6)
+- Code(Counter(7)) at (prev + 1, 13) to (start + 2, 6)
 - Code(Zero) at (prev + 2, 5) to (start + 0, 6)
 - Code(Expression(0, Add)) at (prev + 2, 8) to (start + 0, 21)
-    = (c2 + (((c13 + c14) + c15) + c16))
-- Code(Counter(18)) at (prev + 0, 22) to (start + 2, 6)
-- Code(Expression(24, Sub)) at (prev + 2, 15) to (start + 0, 28)
-    = ((c2 + (((c13 + c14) + c15) + c16)) - c18)
-- Code(Expression(23, Sub)) at (prev + 1, 12) to (start + 0, 25)
-    = (((c2 + (((c13 + c14) + c15) + c16)) - c18) - c12)
-- Code(Expression(22, Sub)) at (prev + 0, 29) to (start + 0, 42)
-    = ((((c2 + (((c13 + c14) + c15) + c16)) - c18) - c12) - c19)
+    = ((((c2 + c3) + c4) + c5) + c6)
+- Code(Counter(8)) at (prev + 0, 22) to (start + 2, 6)
+- Code(Expression(15, Sub)) at (prev + 2, 15) to (start + 0, 28)
+    = (((((c2 + c3) + c4) + c5) + c6) - c8)
+- Code(Expression(16, Sub)) at (prev + 1, 12) to (start + 0, 25)
+    = (((((c2 + c3) + c4) + c5) + c6) - (c8 + c34))
+- Code(Expression(18, Sub)) at (prev + 0, 29) to (start + 0, 42)
+    = (((((c2 + c3) + c4) + c5) + c6) - ((c8 + c9) + c34))
 - Code(Expression(21, Sub)) at (prev + 0, 46) to (start + 0, 60)
-    = (((((c2 + (((c13 + c14) + c15) + c16)) - c18) - c12) - c19) - c20)
-- Code(Expression(32, Add)) at (prev + 0, 61) to (start + 2, 10)
-    = ((c19 + c20) + c21)
-- Code(Counter(22)) at (prev + 2, 9) to (start + 0, 10)
-- Code(Expression(31, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (((c19 + c20) + c21) + c22)
-- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 15)
-- Code(Expression(30, Add)) at (prev + 3, 8) to (start + 0, 12)
-    = (c18 + (((c19 + c20) + c21) + c22))
-- Code(Counter(23)) at (prev + 1, 13) to (start + 1, 16)
-- Code(Counter(24)) at (prev + 1, 17) to (start + 2, 10)
+    = (((((c2 + c3) + c4) + c5) + c6) - (((c8 + c9) + c10) + c34))
+- Code(Expression(28, Add)) at (prev + 0, 61) to (start + 2, 10)
+    = ((c9 + c10) + c11)
+- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 10)
+- Code(Expression(27, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = (((c9 + c10) + c11) + c12)
+- Code(Counter(34)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(115, Add)) at (prev + 3, 8) to (start + 0, 12)
+    = ((((c8 + c9) + c10) + c11) + c12)
+- Code(Counter(13)) at (prev + 1, 13) to (start + 1, 16)
+- Code(Counter(14)) at (prev + 1, 17) to (start + 2, 10)
 - Code(Zero) at (prev + 2, 9) to (start + 0, 10)
-- Code(Counter(23)) at (prev + 2, 12) to (start + 0, 25)
-- Code(Counter(25)) at (prev + 0, 26) to (start + 2, 10)
-- Code(Expression(43, Sub)) at (prev + 4, 17) to (start + 0, 30)
-    = (c23 - c25)
-- Code(Expression(42, Sub)) at (prev + 1, 16) to (start + 0, 29)
-    = ((c23 - c25) - c11)
-- Code(Expression(41, Sub)) at (prev + 0, 33) to (start + 0, 46)
-    = (((c23 - c25) - c11) - c26)
+- Code(Counter(13)) at (prev + 2, 12) to (start + 0, 25)
+- Code(Counter(15)) at (prev + 0, 26) to (start + 2, 10)
+- Code(Expression(34, Sub)) at (prev + 4, 17) to (start + 0, 30)
+    = (c13 - c15)
+- Code(Expression(35, Sub)) at (prev + 1, 16) to (start + 0, 29)
+    = (c13 - (c15 + c33))
+- Code(Expression(37, Sub)) at (prev + 0, 33) to (start + 0, 46)
+    = (c13 - ((c15 + c16) + c33))
 - Code(Expression(40, Sub)) at (prev + 0, 50) to (start + 0, 64)
-    = ((((c23 - c25) - c11) - c26) - c27)
-- Code(Expression(91, Add)) at (prev + 0, 65) to (start + 2, 14)
-    = ((c26 + c27) + c28)
-- Code(Counter(29)) at (prev + 2, 13) to (start + 0, 14)
-- Code(Expression(90, Add)) at (prev + 1, 13) to (start + 0, 27)
-    = (((c26 + c27) + c28) + c29)
-- Code(Counter(11)) at (prev + 2, 13) to (start + 0, 19)
+    = (c13 - (((c15 + c16) + c17) + c33))
+- Code(Expression(47, Add)) at (prev + 0, 65) to (start + 2, 14)
+    = ((c16 + c17) + c18)
+- Code(Counter(19)) at (prev + 2, 13) to (start + 0, 14)
+- Code(Expression(46, Add)) at (prev + 1, 13) to (start + 0, 27)
+    = (((c16 + c17) + c18) + c19)
+- Code(Counter(33)) at (prev + 2, 13) to (start + 0, 19)
 - Code(Zero) at (prev + 2, 5) to (start + 0, 6)
-- Code(Expression(88, Add)) at (prev + 2, 9) to (start + 1, 12)
-    = ((c25 + (((c26 + c27) + c28) + c29)) + Zero)
-- Code(Counter(30)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Expression(63, Sub)) at (prev + 2, 9) to (start + 1, 12)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13)
+- Code(Counter(20)) at (prev + 1, 13) to (start + 2, 6)
 - Code(Zero) at (prev + 2, 5) to (start + 0, 6)
-- Code(Expression(128, Add)) at (prev + 2, 9) to (start + 0, 10)
-    = (c31 + (((c32 + c33) + c34) + c35))
-- Code(Expression(88, Add)) at (prev + 0, 16) to (start + 0, 29)
-    = ((c25 + (((c26 + c27) + c28) + c29)) + Zero)
-- Code(Counter(31)) at (prev + 0, 30) to (start + 2, 6)
-- Code(Expression(87, Sub)) at (prev + 2, 15) to (start + 0, 28)
-    = (((c25 + (((c26 + c27) + c28) + c29)) + Zero) - c31)
-- Code(Expression(86, Sub)) at (prev + 1, 12) to (start + 0, 25)
-    = ((((c25 + (((c26 + c27) + c28) + c29)) + Zero) - c31) - c10)
-- Code(Expression(85, Sub)) at (prev + 0, 29) to (start + 0, 42)
-    = (((((c25 + (((c26 + c27) + c28) + c29)) + Zero) - c31) - c10) - c32)
-- Code(Expression(84, Sub)) at (prev + 0, 46) to (start + 0, 60)
-    = ((((((c25 + (((c26 + c27) + c28) + c29)) + Zero) - c31) - c10) - c32) - c33)
-- Code(Expression(130, Add)) at (prev + 0, 61) to (start + 2, 10)
-    = ((c32 + c33) + c34)
-- Code(Counter(35)) at (prev + 2, 9) to (start + 0, 10)
-- Code(Expression(129, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (((c32 + c33) + c34) + c35)
-- Code(Counter(10)) at (prev + 2, 13) to (start + 2, 15)
-- Code(Expression(138, Add)) at (prev + 5, 9) to (start + 0, 10)
-    = (c4 + (((c5 + c6) + c7) + c8))
-- Code(Expression(128, Add)) at (prev + 0, 16) to (start + 0, 29)
-    = (c31 + (((c32 + c33) + c34) + c35))
-- Code(Counter(4)) at (prev + 0, 30) to (start + 2, 6)
-- Code(Expression(127, Sub)) at (prev + 2, 15) to (start + 0, 28)
-    = ((c31 + (((c32 + c33) + c34) + c35)) - c4)
-- Code(Expression(126, Sub)) at (prev + 1, 12) to (start + 0, 25)
-    = (((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9)
-- Code(Expression(125, Sub)) at (prev + 0, 29) to (start + 0, 42)
-    = ((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5)
-- Code(Expression(124, Sub)) at (prev + 0, 46) to (start + 0, 60)
-    = (((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) - c6)
-- Code(Expression(140, Add)) at (prev + 0, 61) to (start + 2, 10)
-    = ((c5 + c6) + c7)
-- Code(Counter(8)) at (prev + 2, 9) to (start + 0, 10)
-- Code(Expression(139, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (((c5 + c6) + c7) + c8)
-- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15)
-- Code(Expression(137, Add)) at (prev + 2, 1) to (start + 0, 2)
-    = ((c4 + (((c5 + c6) + c7) + c8)) + ((((c9 + c10) + c11) + c12) + ((c0 - c2) - c3)))
+- Code(Expression(155, Add)) at (prev + 2, 9) to (start + 0, 10)
+    = ((((c21 + c22) + c23) + c24) + c25)
+- Code(Expression(63, Sub)) at (prev + 0, 16) to (start + 0, 29)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - c13)
+- Code(Counter(21)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(73, Sub)) at (prev + 2, 15) to (start + 0, 28)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (c13 + c21))
+- Code(Expression(84, Sub)) at (prev + 1, 12) to (start + 0, 25)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((c13 + c21) + c32))
+- Code(Expression(96, Sub)) at (prev + 0, 29) to (start + 0, 42)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - (((c13 + c21) + c22) + c32))
+- Code(Expression(109, Sub)) at (prev + 0, 46) to (start + 0, 60)
+    = ((((((((((c8 + c9) + c10) + c11) + c12) + c15) + c16) + c17) + c18) + c19) - ((((c13 + c21) + c22) + c23) + c32))
+- Code(Expression(126, Add)) at (prev + 0, 61) to (start + 2, 10)
+    = ((c22 + c23) + c24)
+- Code(Counter(25)) at (prev + 2, 9) to (start + 0, 10)
+- Code(Expression(125, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = (((c22 + c23) + c24) + c25)
+- Code(Counter(32)) at (prev + 2, 13) to (start + 2, 15)
+- Code(Expression(128, Add)) at (prev + 5, 9) to (start + 0, 10)
+    = ((((c26 + c27) + c28) + c29) + c30)
+- Code(Expression(155, Add)) at (prev + 0, 16) to (start + 0, 29)
+    = ((((c21 + c22) + c23) + c24) + c25)
+- Code(Counter(26)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(136, Sub)) at (prev + 2, 15) to (start + 0, 28)
+    = (((((c21 + c22) + c23) + c24) + c25) - c26)
+- Code(Expression(141, Sub)) at (prev + 1, 12) to (start + 0, 25)
+    = (((((c21 + c22) + c23) + c24) + c25) - (c26 + c31))
+- Code(Expression(147, Sub)) at (prev + 0, 29) to (start + 0, 42)
+    = (((((c21 + c22) + c23) + c24) + c25) - ((c26 + c27) + c31))
+- Code(Expression(154, Sub)) at (prev + 0, 46) to (start + 0, 60)
+    = (((((c21 + c22) + c23) + c24) + c25) - (((c26 + c27) + c28) + c31))
+- Code(Expression(165, Add)) at (prev + 0, 61) to (start + 2, 10)
+    = ((c27 + c28) + c29)
+- Code(Counter(30)) at (prev + 2, 9) to (start + 0, 10)
+- Code(Expression(164, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = (((c27 + c28) + c29) + c30)
+- Code(Counter(31)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(167, Sub)) at (prev + 2, 1) to (start + 0, 2)
+    = ((((((((((c0 + c26) + c27) + c28) + c29) + c30) + c31) + c32) + c33) + c34) - (c2 + c35))
 Highest counter ID seen: c35
 
diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map
index 7781d2d2544..55313d7db49 100644
--- a/tests/coverage/continue.cov-map
+++ b/tests/coverage/continue.cov-map
@@ -1,5 +1,5 @@
 Function name: continue::main
-Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 31, 5f, 35, 39, 57, 3d, 31, 5f, 35, 39, 35, 39, 3d, 41, 6b, 45, 3d, 41, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02]
+Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 5b, 39, 31, 35, 57, 3d, 5b, 39, 31, 35, 35, 39, 3d, 41, 6b, 45, 3d, 41, 45, 49, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 28
@@ -21,16 +21,16 @@ Number of expressions: 28
 - expression 15 operands: lhs = Expression(16, Add), rhs = Counter(12)
 - expression 16 operands: lhs = Expression(17, Add), rhs = Counter(11)
 - expression 17 operands: lhs = Counter(9), rhs = Counter(10)
-- expression 18 operands: lhs = Counter(12), rhs = Expression(23, Add)
-- expression 19 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 18 operands: lhs = Expression(22, Add), rhs = Counter(14)
+- expression 19 operands: lhs = Counter(12), rhs = Counter(13)
 - expression 20 operands: lhs = Expression(21, Add), rhs = Counter(15)
-- expression 21 operands: lhs = Counter(12), rhs = Expression(23, Add)
-- expression 22 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 21 operands: lhs = Expression(22, Add), rhs = Counter(14)
+- expression 22 operands: lhs = Counter(12), rhs = Counter(13)
 - expression 23 operands: lhs = Counter(13), rhs = Counter(14)
 - expression 24 operands: lhs = Counter(15), rhs = Counter(16)
 - expression 25 operands: lhs = Expression(26, Add), rhs = Counter(17)
 - expression 26 operands: lhs = Counter(15), rhs = Counter(16)
-- expression 27 operands: lhs = Counter(18), rhs = Counter(17)
+- expression 27 operands: lhs = Counter(17), rhs = Counter(18)
 Number of file 0 mappings: 30
 - Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18)
 - Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19)
@@ -60,9 +60,9 @@ Number of file 0 mappings: 30
 - Code(Counter(10)) at (prev + 1, 13) to (start + 0, 21)
 - Code(Counter(11)) at (prev + 1, 10) to (start + 1, 14)
 - Code(Expression(21, Add)) at (prev + 3, 14) to (start + 0, 19)
-    = (c12 + (c13 + c14))
+    = ((c12 + c13) + c14)
 - Code(Expression(20, Sub)) at (prev + 1, 15) to (start + 0, 22)
-    = ((c12 + (c13 + c14)) - c15)
+    = (((c12 + c13) + c14) - c15)
 - Code(Counter(14)) at (prev + 1, 22) to (start + 2, 14)
 - Code(Counter(13)) at (prev + 3, 18) to (start + 2, 14)
 - Code(Expression(23, Add)) at (prev + 4, 9) to (start + 0, 14)
@@ -75,6 +75,6 @@ Number of file 0 mappings: 30
 - Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22)
 - Code(Counter(16)) at (prev + 3, 9) to (start + 0, 14)
 - Code(Expression(27, Add)) at (prev + 2, 13) to (start + 1, 2)
-    = (c18 + c17)
+    = (c17 + c18)
 Highest counter ID seen: c18
 
diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map
index 2fdc3220c19..21f6787e9f2 100644
--- a/tests/coverage/coroutine.cov-map
+++ b/tests/coverage/coroutine.cov-map
@@ -13,18 +13,18 @@ Number of file 0 mappings: 4
 Highest counter ID seen: c1
 
 Function name: coroutine::main
-Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
+Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 11, 1f, 15, 19, 15, 19, 11, 1f, 15, 19, 09, 01, 13, 01, 02, 16, 01, 08, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 0a, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 8
 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
 - expression 1 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 2 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 3 operands: lhs = Expression(7, Sub), rhs = Counter(6)
-- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 3 operands: lhs = Counter(4), rhs = Expression(7, Add)
+- expression 4 operands: lhs = Counter(5), rhs = Counter(6)
 - expression 5 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(6)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 6 operands: lhs = Counter(4), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(5), rhs = Counter(6)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 19, 1) to (start + 2, 22)
 - Code(Counter(0)) at (prev + 8, 11) to (start + 0, 46)
@@ -32,14 +32,14 @@ Number of file 0 mappings: 9
 - Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 53)
     = ((c1 + c2) + c3)
 - Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46)
-- Code(Expression(7, Sub)) at (prev + 1, 34) to (start + 0, 39)
+- Code(Expression(2, Sub)) at (prev + 1, 34) to (start + 0, 39)
     = (c4 - c5)
 - Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 46)
-    = ((c4 - c5) - c6)
-- Code(Expression(5, Add)) at (prev + 1, 14) to (start + 0, 53)
+    = (c4 - (c5 + c6))
+- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53)
     = (c5 + c6)
 - Code(Expression(6, Sub)) at (prev + 2, 1) to (start + 0, 2)
-    = ((c4 - c5) - c6)
+    = (c4 - (c5 + c6))
 Highest counter ID seen: c4
 
 Function name: coroutine::main::{closure#0}
diff --git a/tests/coverage/inline-dead.cov-map b/tests/coverage/inline-dead.cov-map
index 5a20de3d4d4..3e2ca2bc992 100644
--- a/tests/coverage/inline-dead.cov-map
+++ b/tests/coverage/inline-dead.cov-map
@@ -32,16 +32,16 @@ Number of file 0 mappings: 2
 Highest counter ID seen: c0
 
 Function name: inline_dead::main::{closure#0}
-Raw bytes (23): 0x[01, 01, 02, 00, 06, 01, 00, 03, 01, 07, 17, 01, 16, 00, 01, 17, 00, 18, 03, 01, 05, 00, 06]
+Raw bytes (23): 0x[01, 01, 02, 07, 00, 01, 00, 03, 01, 07, 17, 01, 16, 00, 01, 17, 00, 18, 02, 01, 05, 00, 06]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 2
-- expression 0 operands: lhs = Zero, rhs = Expression(1, Sub)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Zero
 - expression 1 operands: lhs = Counter(0), rhs = Zero
 Number of file 0 mappings: 3
 - Code(Counter(0)) at (prev + 7, 23) to (start + 1, 22)
 - Code(Zero) at (prev + 1, 23) to (start + 0, 24)
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 0, 6)
-    = (Zero + (c0 - Zero))
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 6)
+    = ((c0 + Zero) - Zero)
 Highest counter ID seen: c0
 
diff --git a/tests/coverage/inline.cov-map b/tests/coverage/inline.cov-map
index ab3a505e925..1b5b45695dc 100644
--- a/tests/coverage/inline.cov-map
+++ b/tests/coverage/inline.cov-map
@@ -41,14 +41,15 @@ Number of file 0 mappings: 1
 Highest counter ID seen: c0
 
 Function name: inline::permutate::<char>
-Raw bytes (52): 0x[01, 01, 04, 01, 05, 02, 0d, 05, 0f, 09, 0d, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (54): 0x[01, 01, 05, 01, 05, 01, 0b, 05, 0d, 13, 0d, 05, 09, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0f, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 5
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(1), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(3)
+- expression 4 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 15, 1) to (start + 2, 14)
 - Code(Counter(1)) at (prev + 2, 15) to (start + 2, 6)
@@ -56,11 +57,11 @@ Number of file 0 mappings: 8
     = (c0 - c1)
 - Code(Counter(4)) at (prev + 1, 13) to (start + 0, 14)
 - Code(Expression(1, Sub)) at (prev + 0, 18) to (start + 0, 22)
-    = ((c0 - c1) - c3)
+    = (c0 - (c1 + c3))
 - Code(Counter(4)) at (prev + 0, 23) to (start + 4, 10)
 - Code(Counter(3)) at (prev + 5, 12) to (start + 2, 6)
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c1 + (c2 + c3))
+- Code(Expression(3, Add)) at (prev + 3, 1) to (start + 0, 2)
+    = ((c1 + c2) + c3)
 Highest counter ID seen: c4
 
 Function name: inline::permutations::<char>
diff --git a/tests/coverage/issue-84561.cov-map b/tests/coverage/issue-84561.cov-map
index 64870c434b3..a2ab558f960 100644
--- a/tests/coverage/issue-84561.cov-map
+++ b/tests/coverage/issue-84561.cov-map
@@ -59,69 +59,69 @@ Number of file 0 mappings: 1
 Highest counter ID seen: c0
 
 Function name: issue_84561::test3
-Raw bytes (414): 0x[01, 01, 3b, 05, 09, 0d, 11, 15, 19, 1e, 1d, 15, 19, 1a, 21, 1e, 1d, 15, 19, 25, 2d, 21, 25, 29, 35, 32, 29, 21, 25, 31, 39, 3d, 41, 42, 45, 3d, 41, 66, 49, 45, 4d, 63, 51, 66, 49, 45, 4d, 5e, 55, 63, 51, 66, 49, 45, 4d, 9e, 01, 55, 51, 59, 9e, 01, 55, 51, 59, 9b, 01, 5d, 9e, 01, 55, 51, 59, 9b, 01, 61, 9e, 01, 55, 51, 59, 96, 01, 65, 9b, 01, 61, 9e, 01, 55, 51, 59, 75, e2, 01, e6, 01, 79, 69, 6d, 69, 6d, 69, 6d, e6, 01, 00, 69, 6d, e6, 01, 79, 69, 6d, df, 01, 7d, 75, e2, 01, e6, 01, 79, 69, 6d, da, 01, 81, 01, df, 01, 7d, 75, e2, 01, e6, 01, 79, 69, 6d, 81, 01, 85, 01, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 1e, 02, 05, 00, 1f, 1a, 01, 05, 00, 0f, 16, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 25, 03, 20, 00, 30, 2d, 00, 33, 00, 41, 22, 00, 4b, 00, 5a, 32, 01, 05, 00, 0f, 29, 05, 09, 03, 10, 35, 05, 0d, 00, 1b, 2a, 02, 0d, 00, 1c, 2e, 04, 09, 05, 06, 31, 06, 05, 03, 06, 36, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 42, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 3e, 05, 09, 03, 0a, 63, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 59, 03, 0d, 00, 1d, 5e, 03, 09, 00, 13, 5a, 03, 0d, 00, 1d, 9b, 01, 03, 05, 00, 0f, 9b, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 7a, 02, 0d, 00, 13, 96, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 92, 01, 02, 0d, 00, 13, df, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, e6, 01, 02, 0d, 00, 17, e6, 01, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, b6, 01, 02, 15, 00, 1b, e2, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, da, 01, 02, 05, 00, 0f, d6, 01, 03, 09, 00, 22, 81, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 2c, 85, 01, 02, 01, 00, 02]
+Raw bytes (409): 0x[01, 01, 3b, 05, 09, 0d, 11, 15, 19, 15, 1f, 19, 1d, 15, 1b, 1f, 21, 19, 1d, 25, 29, 21, 25, 2d, 31, 21, 33, 25, 2d, 35, 39, 3d, 41, 3d, 43, 41, 45, 5f, 4d, 45, 49, 5f, 67, 45, 49, 4d, 51, 5f, 63, 45, 49, 67, 59, 4d, 51, 97, 01, 55, 51, 59, 97, 01, 55, 51, 59, 97, 01, 83, 01, 51, 59, 55, 5d, 97, 01, 9f, 01, 51, 59, 55, 61, 97, 01, 9b, 01, 51, 59, 9f, 01, 65, 55, 61, db, 01, e7, 01, 69, 71, 6d, 75, 69, 6d, 69, 6d, 69, bb, 01, 6d, 00, 69, e7, 01, 6d, 75, db, 01, e3, 01, 69, 71, e7, 01, 79, 6d, 75, db, 01, df, 01, 69, 71, e3, 01, 7d, e7, 01, 79, 6d, 75, 7d, 81, 01, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 0a, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 16, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 25, 03, 20, 00, 30, 29, 00, 33, 00, 41, 22, 00, 4b, 00, 5a, 26, 01, 05, 00, 0f, 2d, 05, 09, 03, 10, 31, 05, 0d, 00, 1b, 2a, 02, 0d, 00, 1c, 2e, 04, 09, 05, 06, 35, 06, 05, 03, 06, 36, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 3a, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 3e, 05, 09, 03, 0a, 46, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 55, 03, 0d, 00, 1d, 4e, 03, 09, 00, 13, 5a, 03, 0d, 00, 1d, 72, 03, 05, 00, 0f, 72, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 7a, 02, 0d, 00, 13, 86, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 92, 01, 02, 0d, 00, 13, a2, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 71, 04, 0d, 00, 13, b2, 01, 02, 0d, 00, 17, b2, 01, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, b6, 01, 02, 15, 00, 1b, be, 01, 04, 0d, 00, 13, 79, 03, 09, 00, 19, c6, 01, 02, 05, 00, 0f, d6, 01, 03, 09, 00, 22, 7d, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 2c, 81, 01, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 59
 - expression 0 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 1 operands: lhs = Counter(3), rhs = Counter(4)
 - expression 2 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 3 operands: lhs = Expression(7, Sub), rhs = Counter(7)
-- expression 4 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 5 operands: lhs = Expression(6, Sub), rhs = Counter(8)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(7)
-- expression 7 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 8 operands: lhs = Counter(9), rhs = Counter(11)
+- expression 3 operands: lhs = Counter(5), rhs = Expression(7, Add)
+- expression 4 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 5 operands: lhs = Counter(5), rhs = Expression(6, Add)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(8)
+- expression 7 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 8 operands: lhs = Counter(9), rhs = Counter(10)
 - expression 9 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 10 operands: lhs = Counter(10), rhs = Counter(13)
-- expression 11 operands: lhs = Expression(12, Sub), rhs = Counter(10)
-- expression 12 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 13 operands: lhs = Counter(12), rhs = Counter(14)
+- expression 10 operands: lhs = Counter(11), rhs = Counter(12)
+- expression 11 operands: lhs = Counter(8), rhs = Expression(12, Add)
+- expression 12 operands: lhs = Counter(9), rhs = Counter(11)
+- expression 13 operands: lhs = Counter(13), rhs = Counter(14)
 - expression 14 operands: lhs = Counter(15), rhs = Counter(16)
-- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(17)
-- expression 16 operands: lhs = Counter(15), rhs = Counter(16)
-- expression 17 operands: lhs = Expression(25, Sub), rhs = Counter(18)
-- expression 18 operands: lhs = Counter(17), rhs = Counter(19)
-- expression 19 operands: lhs = Expression(24, Add), rhs = Counter(20)
-- expression 20 operands: lhs = Expression(25, Sub), rhs = Counter(18)
-- expression 21 operands: lhs = Counter(17), rhs = Counter(19)
-- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(21)
-- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(20)
-- expression 24 operands: lhs = Expression(25, Sub), rhs = Counter(18)
-- expression 25 operands: lhs = Counter(17), rhs = Counter(19)
-- expression 26 operands: lhs = Expression(39, Sub), rhs = Counter(21)
+- expression 15 operands: lhs = Counter(15), rhs = Expression(16, Add)
+- expression 16 operands: lhs = Counter(16), rhs = Counter(17)
+- expression 17 operands: lhs = Expression(23, Add), rhs = Counter(19)
+- expression 18 operands: lhs = Counter(17), rhs = Counter(18)
+- expression 19 operands: lhs = Expression(23, Add), rhs = Expression(25, Add)
+- expression 20 operands: lhs = Counter(17), rhs = Counter(18)
+- expression 21 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 22 operands: lhs = Expression(23, Add), rhs = Expression(24, Add)
+- expression 23 operands: lhs = Counter(17), rhs = Counter(18)
+- expression 24 operands: lhs = Expression(25, Add), rhs = Counter(22)
+- expression 25 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 26 operands: lhs = Expression(37, Add), rhs = Counter(21)
 - expression 27 operands: lhs = Counter(20), rhs = Counter(22)
-- expression 28 operands: lhs = Expression(39, Sub), rhs = Counter(21)
+- expression 28 operands: lhs = Expression(37, Add), rhs = Counter(21)
 - expression 29 operands: lhs = Counter(20), rhs = Counter(22)
-- expression 30 operands: lhs = Expression(38, Add), rhs = Counter(23)
-- expression 31 operands: lhs = Expression(39, Sub), rhs = Counter(21)
-- expression 32 operands: lhs = Counter(20), rhs = Counter(22)
-- expression 33 operands: lhs = Expression(38, Add), rhs = Counter(24)
-- expression 34 operands: lhs = Expression(39, Sub), rhs = Counter(21)
-- expression 35 operands: lhs = Counter(20), rhs = Counter(22)
-- expression 36 operands: lhs = Expression(37, Sub), rhs = Counter(25)
-- expression 37 operands: lhs = Expression(38, Add), rhs = Counter(24)
-- expression 38 operands: lhs = Expression(39, Sub), rhs = Counter(21)
-- expression 39 operands: lhs = Counter(20), rhs = Counter(22)
-- expression 40 operands: lhs = Counter(29), rhs = Expression(56, Sub)
-- expression 41 operands: lhs = Expression(57, Sub), rhs = Counter(30)
-- expression 42 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 30 operands: lhs = Expression(37, Add), rhs = Expression(32, Add)
+- expression 31 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 32 operands: lhs = Counter(21), rhs = Counter(23)
+- expression 33 operands: lhs = Expression(37, Add), rhs = Expression(39, Add)
+- expression 34 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 35 operands: lhs = Counter(21), rhs = Counter(24)
+- expression 36 operands: lhs = Expression(37, Add), rhs = Expression(38, Add)
+- expression 37 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 38 operands: lhs = Expression(39, Add), rhs = Counter(25)
+- expression 39 operands: lhs = Counter(21), rhs = Counter(24)
+- expression 40 operands: lhs = Expression(54, Add), rhs = Expression(57, Add)
+- expression 41 operands: lhs = Counter(26), rhs = Counter(28)
+- expression 42 operands: lhs = Counter(27), rhs = Counter(29)
 - expression 43 operands: lhs = Counter(26), rhs = Counter(27)
 - expression 44 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 45 operands: lhs = Expression(57, Sub), rhs = Zero
-- expression 46 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 47 operands: lhs = Expression(57, Sub), rhs = Counter(30)
-- expression 48 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 49 operands: lhs = Expression(55, Add), rhs = Counter(31)
-- expression 50 operands: lhs = Counter(29), rhs = Expression(56, Sub)
-- expression 51 operands: lhs = Expression(57, Sub), rhs = Counter(30)
-- expression 52 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 53 operands: lhs = Expression(54, Sub), rhs = Counter(32)
-- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(31)
-- expression 55 operands: lhs = Counter(29), rhs = Expression(56, Sub)
-- expression 56 operands: lhs = Expression(57, Sub), rhs = Counter(30)
-- expression 57 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 58 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 45 operands: lhs = Counter(26), rhs = Expression(46, Add)
+- expression 46 operands: lhs = Counter(27), rhs = Zero
+- expression 47 operands: lhs = Counter(26), rhs = Expression(57, Add)
+- expression 48 operands: lhs = Counter(27), rhs = Counter(29)
+- expression 49 operands: lhs = Expression(54, Add), rhs = Expression(56, Add)
+- expression 50 operands: lhs = Counter(26), rhs = Counter(28)
+- expression 51 operands: lhs = Expression(57, Add), rhs = Counter(30)
+- expression 52 operands: lhs = Counter(27), rhs = Counter(29)
+- expression 53 operands: lhs = Expression(54, Add), rhs = Expression(55, Add)
+- expression 54 operands: lhs = Counter(26), rhs = Counter(28)
+- expression 55 operands: lhs = Expression(56, Add), rhs = Counter(31)
+- expression 56 operands: lhs = Expression(57, Add), rhs = Counter(30)
+- expression 57 operands: lhs = Counter(27), rhs = Counter(29)
+- expression 58 operands: lhs = Counter(31), rhs = Counter(32)
 Number of file 0 mappings: 51
 - Code(Counter(0)) at (prev + 8, 1) to (start + 3, 28)
 - Code(Counter(1)) at (prev + 4, 9) to (start + 1, 28)
@@ -131,76 +131,76 @@ Number of file 0 mappings: 51
 - Code(Expression(1, Sub)) at (prev + 1, 5) to (start + 0, 31)
     = (c3 - c4)
 - Code(Counter(5)) at (prev + 1, 9) to (start + 1, 28)
-- Code(Expression(7, Sub)) at (prev + 2, 5) to (start + 0, 31)
+- Code(Expression(2, Sub)) at (prev + 2, 5) to (start + 0, 31)
     = (c5 - c6)
-- Code(Expression(6, Sub)) at (prev + 1, 5) to (start + 0, 15)
-    = ((c5 - c6) - c7)
+- Code(Expression(3, Sub)) at (prev + 1, 5) to (start + 0, 15)
+    = (c5 - (c6 + c7))
 - Code(Expression(5, Sub)) at (prev + 0, 32) to (start + 0, 48)
-    = (((c5 - c6) - c7) - c8)
+    = (c5 - ((c6 + c7) + c8))
 - Code(Counter(8)) at (prev + 1, 5) to (start + 3, 15)
 - Code(Counter(9)) at (prev + 3, 32) to (start + 0, 48)
-- Code(Counter(11)) at (prev + 0, 51) to (start + 0, 65)
+- Code(Counter(10)) at (prev + 0, 51) to (start + 0, 65)
 - Code(Expression(8, Sub)) at (prev + 0, 75) to (start + 0, 90)
-    = (c9 - c11)
-- Code(Expression(12, Sub)) at (prev + 1, 5) to (start + 0, 15)
+    = (c9 - c10)
+- Code(Expression(9, Sub)) at (prev + 1, 5) to (start + 0, 15)
     = (c8 - c9)
-- Code(Counter(10)) at (prev + 5, 9) to (start + 3, 16)
-- Code(Counter(13)) at (prev + 5, 13) to (start + 0, 27)
+- Code(Counter(11)) at (prev + 5, 9) to (start + 3, 16)
+- Code(Counter(12)) at (prev + 5, 13) to (start + 0, 27)
 - Code(Expression(10, Sub)) at (prev + 2, 13) to (start + 0, 28)
-    = (c10 - c13)
+    = (c11 - c12)
 - Code(Expression(11, Sub)) at (prev + 4, 9) to (start + 5, 6)
-    = ((c8 - c9) - c10)
-- Code(Counter(12)) at (prev + 6, 5) to (start + 3, 6)
+    = (c8 - (c9 + c11))
+- Code(Counter(13)) at (prev + 6, 5) to (start + 3, 6)
 - Code(Expression(13, Sub)) at (prev + 4, 5) to (start + 3, 6)
-    = (c12 - c14)
+    = (c13 - c14)
 - Code(Counter(15)) at (prev + 4, 9) to (start + 4, 6)
-- Code(Expression(16, Sub)) at (prev + 5, 8) to (start + 0, 15)
+- Code(Expression(14, Sub)) at (prev + 5, 8) to (start + 0, 15)
     = (c15 - c16)
 - Code(Counter(17)) at (prev + 1, 9) to (start + 3, 10)
 - Code(Expression(15, Sub)) at (prev + 5, 9) to (start + 3, 10)
-    = ((c15 - c16) - c17)
-- Code(Expression(24, Add)) at (prev + 5, 8) to (start + 0, 15)
-    = ((c17 - c19) + c18)
+    = (c15 - (c16 + c17))
+- Code(Expression(17, Sub)) at (prev + 5, 8) to (start + 0, 15)
+    = ((c17 + c18) - c19)
 - Code(Counter(20)) at (prev + 1, 9) to (start + 0, 19)
-- Code(Counter(22)) at (prev + 3, 13) to (start + 0, 29)
-- Code(Expression(23, Sub)) at (prev + 3, 9) to (start + 0, 19)
-    = (((c17 - c19) + c18) - c20)
+- Code(Counter(21)) at (prev + 3, 13) to (start + 0, 29)
+- Code(Expression(19, Sub)) at (prev + 3, 9) to (start + 0, 19)
+    = ((c17 + c18) - (c19 + c20))
 - Code(Expression(22, Sub)) at (prev + 3, 13) to (start + 0, 29)
-    = ((((c17 - c19) + c18) - c20) - c21)
-- Code(Expression(38, Add)) at (prev + 3, 5) to (start + 0, 15)
-    = ((c20 - c22) + c21)
-- Code(Expression(38, Add)) at (prev + 1, 12) to (start + 0, 19)
-    = ((c20 - c22) + c21)
+    = ((c17 + c18) - ((c19 + c20) + c22))
+- Code(Expression(28, Sub)) at (prev + 3, 5) to (start + 0, 15)
+    = ((c20 + c22) - c21)
+- Code(Expression(28, Sub)) at (prev + 1, 12) to (start + 0, 19)
+    = ((c20 + c22) - c21)
 - Code(Counter(23)) at (prev + 1, 13) to (start + 0, 19)
 - Code(Expression(30, Sub)) at (prev + 2, 13) to (start + 0, 19)
-    = (((c20 - c22) + c21) - c23)
-- Code(Expression(37, Sub)) at (prev + 4, 5) to (start + 2, 19)
-    = (((c20 - c22) + c21) - c24)
+    = ((c20 + c22) - (c21 + c23))
+- Code(Expression(33, Sub)) at (prev + 4, 5) to (start + 2, 19)
+    = ((c20 + c22) - (c21 + c24))
 - Code(Counter(25)) at (prev + 3, 13) to (start + 0, 19)
 - Code(Expression(36, Sub)) at (prev + 2, 13) to (start + 0, 19)
-    = ((((c20 - c22) + c21) - c24) - c25)
-- Code(Expression(55, Add)) at (prev + 3, 5) to (start + 0, 15)
-    = (c29 + ((c26 - c27) - c30))
+    = ((c20 + c22) - ((c21 + c24) + c25))
+- Code(Expression(40, Sub)) at (prev + 3, 5) to (start + 0, 15)
+    = ((c26 + c28) - (c27 + c29))
 - Code(Counter(26)) at (prev + 1, 12) to (start + 0, 19)
 - Code(Counter(27)) at (prev + 1, 13) to (start + 3, 14)
-- Code(Counter(29)) at (prev + 4, 13) to (start + 0, 19)
-- Code(Expression(57, Sub)) at (prev + 2, 13) to (start + 0, 23)
+- Code(Counter(28)) at (prev + 4, 13) to (start + 0, 19)
+- Code(Expression(44, Sub)) at (prev + 2, 13) to (start + 0, 23)
     = (c26 - c27)
-- Code(Expression(57, Sub)) at (prev + 1, 20) to (start + 0, 27)
+- Code(Expression(44, Sub)) at (prev + 1, 20) to (start + 0, 27)
     = (c26 - c27)
 - Code(Zero) at (prev + 1, 21) to (start + 0, 27)
 - Code(Expression(45, Sub)) at (prev + 2, 21) to (start + 0, 27)
-    = ((c26 - c27) - Zero)
-- Code(Expression(56, Sub)) at (prev + 4, 13) to (start + 0, 19)
-    = ((c26 - c27) - c30)
-- Code(Counter(31)) at (prev + 3, 9) to (start + 0, 25)
-- Code(Expression(54, Sub)) at (prev + 2, 5) to (start + 0, 15)
-    = ((c29 + ((c26 - c27) - c30)) - c31)
+    = (c26 - (c27 + Zero))
+- Code(Expression(47, Sub)) at (prev + 4, 13) to (start + 0, 19)
+    = (c26 - (c27 + c29))
+- Code(Counter(30)) at (prev + 3, 9) to (start + 0, 25)
+- Code(Expression(49, Sub)) at (prev + 2, 5) to (start + 0, 15)
+    = ((c26 + c28) - ((c27 + c29) + c30))
 - Code(Expression(53, Sub)) at (prev + 3, 9) to (start + 0, 34)
-    = (((c29 + ((c26 - c27) - c30)) - c31) - c32)
-- Code(Counter(32)) at (prev + 2, 5) to (start + 0, 15)
+    = ((c26 + c28) - (((c27 + c29) + c30) + c31))
+- Code(Counter(31)) at (prev + 2, 5) to (start + 0, 15)
 - Code(Expression(58, Sub)) at (prev + 3, 9) to (start + 0, 44)
-    = (c32 - c33)
-- Code(Counter(33)) at (prev + 2, 1) to (start + 0, 2)
-Highest counter ID seen: c33
+    = (c31 - c32)
+- Code(Counter(32)) at (prev + 2, 1) to (start + 0, 2)
+Highest counter ID seen: c32
 
diff --git a/tests/coverage/lazy_boolean.cov-map b/tests/coverage/lazy_boolean.cov-map
index b0c2d736573..3f7788da1eb 100644
--- a/tests/coverage/lazy_boolean.cov-map
+++ b/tests/coverage/lazy_boolean.cov-map
@@ -1,15 +1,15 @@
 Function name: lazy_boolean::main
-Raw bytes (158): 0x[01, 01, 07, 01, 05, 01, 09, 01, 0d, 01, 19, 01, 1d, 01, 21, 01, 25, 1c, 01, 04, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 05, 00, 06, 01, 02, 09, 00, 11, 01, 02, 0d, 00, 12, 06, 02, 0d, 00, 12, 01, 03, 09, 00, 11, 01, 02, 0d, 00, 12, 0a, 02, 0d, 00, 12, 01, 02, 09, 00, 11, 01, 00, 14, 00, 19, 11, 00, 1d, 00, 22, 01, 01, 09, 00, 11, 01, 00, 14, 00, 19, 15, 00, 1d, 00, 22, 01, 03, 09, 01, 10, 0e, 02, 05, 03, 06, 19, 03, 05, 00, 06, 01, 03, 09, 00, 10, 1d, 01, 05, 03, 06, 12, 05, 05, 03, 06, 01, 05, 08, 00, 10, 16, 00, 11, 02, 06, 21, 02, 05, 00, 06, 01, 02, 08, 00, 0f, 25, 00, 10, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02]
+Raw bytes (158): 0x[01, 01, 07, 01, 05, 01, 25, 01, 21, 01, 11, 01, 15, 01, 19, 01, 1d, 1c, 01, 04, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 05, 00, 06, 01, 02, 09, 00, 11, 01, 02, 0d, 00, 12, 06, 02, 0d, 00, 12, 01, 03, 09, 00, 11, 01, 02, 0d, 00, 12, 0a, 02, 0d, 00, 12, 01, 02, 09, 00, 11, 01, 00, 14, 00, 19, 09, 00, 1d, 00, 22, 01, 01, 09, 00, 11, 01, 00, 14, 00, 19, 0d, 00, 1d, 00, 22, 01, 03, 09, 01, 10, 0e, 02, 05, 03, 06, 11, 03, 05, 00, 06, 01, 03, 09, 00, 10, 15, 01, 05, 03, 06, 12, 05, 05, 03, 06, 01, 05, 08, 00, 10, 16, 00, 11, 02, 06, 19, 02, 05, 00, 06, 01, 02, 08, 00, 0f, 1d, 00, 10, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 7
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(0), rhs = Counter(2)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(0), rhs = Counter(6)
-- expression 4 operands: lhs = Counter(0), rhs = Counter(7)
-- expression 5 operands: lhs = Counter(0), rhs = Counter(8)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(9)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(9)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(8)
+- expression 3 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 4 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(6)
+- expression 6 operands: lhs = Counter(0), rhs = Counter(7)
 Number of file 0 mappings: 28
 - Code(Counter(0)) at (prev + 4, 1) to (start + 7, 15)
 - Code(Counter(1)) at (prev + 7, 16) to (start + 4, 6)
@@ -18,33 +18,33 @@ Number of file 0 mappings: 28
 - Code(Counter(0)) at (prev + 2, 9) to (start + 0, 17)
 - Code(Counter(0)) at (prev + 2, 13) to (start + 0, 18)
 - Code(Expression(1, Sub)) at (prev + 2, 13) to (start + 0, 18)
-    = (c0 - c2)
+    = (c0 - c9)
 - Code(Counter(0)) at (prev + 3, 9) to (start + 0, 17)
 - Code(Counter(0)) at (prev + 2, 13) to (start + 0, 18)
 - Code(Expression(2, Sub)) at (prev + 2, 13) to (start + 0, 18)
-    = (c0 - c3)
+    = (c0 - c8)
 - Code(Counter(0)) at (prev + 2, 9) to (start + 0, 17)
 - Code(Counter(0)) at (prev + 0, 20) to (start + 0, 25)
-- Code(Counter(4)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Counter(2)) at (prev + 0, 29) to (start + 0, 34)
 - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 17)
 - Code(Counter(0)) at (prev + 0, 20) to (start + 0, 25)
-- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Counter(3)) at (prev + 0, 29) to (start + 0, 34)
 - Code(Counter(0)) at (prev + 3, 9) to (start + 1, 16)
 - Code(Expression(3, Sub)) at (prev + 2, 5) to (start + 3, 6)
-    = (c0 - c6)
-- Code(Counter(6)) at (prev + 3, 5) to (start + 0, 6)
+    = (c0 - c4)
+- Code(Counter(4)) at (prev + 3, 5) to (start + 0, 6)
 - Code(Counter(0)) at (prev + 3, 9) to (start + 0, 16)
-- Code(Counter(7)) at (prev + 1, 5) to (start + 3, 6)
+- Code(Counter(5)) at (prev + 1, 5) to (start + 3, 6)
 - Code(Expression(4, Sub)) at (prev + 5, 5) to (start + 3, 6)
-    = (c0 - c7)
+    = (c0 - c5)
 - Code(Counter(0)) at (prev + 5, 8) to (start + 0, 16)
 - Code(Expression(5, Sub)) at (prev + 0, 17) to (start + 2, 6)
-    = (c0 - c8)
-- Code(Counter(8)) at (prev + 2, 5) to (start + 0, 6)
+    = (c0 - c6)
+- Code(Counter(6)) at (prev + 2, 5) to (start + 0, 6)
 - Code(Counter(0)) at (prev + 2, 8) to (start + 0, 15)
-- Code(Counter(9)) at (prev + 0, 16) to (start + 2, 6)
+- Code(Counter(7)) at (prev + 0, 16) to (start + 2, 6)
 - Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6)
-    = (c0 - c9)
+    = (c0 - c7)
 - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2)
-Highest counter ID seen: c9
+Highest counter ID seen: c7
 
diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map
index 61a6bda676a..14707701d8a 100644
--- a/tests/coverage/loops_branches.cov-map
+++ b/tests/coverage/loops_branches.cov-map
@@ -1,50 +1,42 @@
 Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt
-Raw bytes (228): 0x[01, 01, 2a, 05, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, a3, 01, a7, 01, 0d, 00, 11, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 9a, 01, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 96, 01, 00, 9a, 01, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 9a, 01, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 96, 01, 11, 9a, 01, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 8f, 01, 19, 25, 92, 01, 96, 01, 11, 9a, 01, 00, 9f, 01, 19, a3, 01, a7, 01, 0d, 00, 11, 00, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 9a, 01, 03, 0d, 00, 0e, 9f, 01, 00, 12, 00, 17, 9a, 01, 01, 10, 00, 14, 96, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 46, 01, 11, 00, 12, 96, 01, 01, 11, 00, 22, 92, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 8b, 01, 01, 05, 00, 06]
+Raw bytes (174): 0x[01, 01, 22, 05, 00, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 2f, 05, 67, 00, 77, 19, 01, 15, 2f, 7b, 67, 00, 77, 19, 01, 15, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 67, 5b, 77, 19, 01, 15, 7b, 00, 05, 21, 67, 7b, 77, 19, 01, 15, 05, 21, 77, 7b, 01, 15, 05, 21, 83, 01, 05, 87, 01, 15, 01, 11, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 2a, 03, 0d, 00, 0e, 1a, 00, 12, 00, 17, 2a, 01, 10, 00, 14, 62, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 4e, 01, 11, 00, 12, 62, 01, 11, 00, 22, 72, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 21, 03, 09, 00, 0f, 7e, 01, 05, 00, 06]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 42
+Number of expressions: 34
 - expression 0 operands: lhs = Counter(1), rhs = Zero
-- expression 1 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 2 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 3 operands: lhs = Counter(3), rhs = Zero
-- expression 4 operands: lhs = Counter(4), rhs = Zero
-- expression 5 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 6 operands: lhs = Counter(3), rhs = Zero
-- expression 7 operands: lhs = Counter(4), rhs = Zero
-- expression 8 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 9 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 10 operands: lhs = Counter(3), rhs = Zero
-- expression 11 operands: lhs = Counter(4), rhs = Zero
-- expression 12 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 13 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 14 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 15 operands: lhs = Counter(3), rhs = Zero
-- expression 16 operands: lhs = Counter(4), rhs = Zero
-- expression 17 operands: lhs = Expression(37, Sub), rhs = Zero
-- expression 18 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 19 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 20 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 21 operands: lhs = Counter(3), rhs = Zero
-- expression 22 operands: lhs = Counter(4), rhs = Zero
-- expression 23 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 24 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 25 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 26 operands: lhs = Counter(3), rhs = Zero
-- expression 27 operands: lhs = Counter(4), rhs = Zero
-- expression 28 operands: lhs = Expression(37, Sub), rhs = Counter(4)
-- expression 29 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 30 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 31 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 32 operands: lhs = Counter(3), rhs = Zero
-- expression 33 operands: lhs = Counter(4), rhs = Zero
-- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(6)
-- expression 35 operands: lhs = Counter(9), rhs = Expression(36, Sub)
-- expression 36 operands: lhs = Expression(37, Sub), rhs = Counter(4)
-- expression 37 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 38 operands: lhs = Expression(39, Add), rhs = Counter(6)
-- expression 39 operands: lhs = Expression(40, Add), rhs = Expression(41, Add)
-- expression 40 operands: lhs = Counter(3), rhs = Zero
-- expression 41 operands: lhs = Counter(4), rhs = Zero
+- expression 1 operands: lhs = Expression(11, Add), rhs = Expression(30, Add)
+- expression 2 operands: lhs = Expression(25, Add), rhs = Zero
+- expression 3 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 4 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 5 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 6 operands: lhs = Expression(11, Add), rhs = Counter(1)
+- expression 7 operands: lhs = Expression(25, Add), rhs = Zero
+- expression 8 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Expression(30, Add)
+- expression 11 operands: lhs = Expression(25, Add), rhs = Zero
+- expression 12 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 13 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 14 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 15 operands: lhs = Expression(25, Add), rhs = Expression(30, Add)
+- expression 16 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 17 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 18 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 19 operands: lhs = Expression(25, Add), rhs = Expression(22, Add)
+- expression 20 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 21 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 22 operands: lhs = Expression(30, Add), rhs = Zero
+- expression 23 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 24 operands: lhs = Expression(25, Add), rhs = Expression(30, Add)
+- expression 25 operands: lhs = Expression(29, Add), rhs = Counter(6)
+- expression 26 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 27 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 28 operands: lhs = Expression(29, Add), rhs = Expression(30, Add)
+- expression 29 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 30 operands: lhs = Counter(1), rhs = Counter(8)
+- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1)
+- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(5)
+- expression 33 operands: lhs = Counter(0), rhs = Counter(4)
 Number of file 0 mappings: 20
 - Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16)
 - Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21)
@@ -53,78 +45,59 @@ Number of file 0 mappings: 20
 - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 14)
     = (c1 - Zero)
 - Code(Counter(1)) at (prev + 1, 13) to (start + 0, 30)
-- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31)
 - Code(Zero) at (prev + 1, 16) to (start + 1, 10)
-- Code(Expression(38, Sub)) at (prev + 3, 13) to (start + 0, 14)
-    = (((c3 + Zero) + (c4 + Zero)) - c6)
-- Code(Expression(39, Add)) at (prev + 0, 18) to (start + 0, 23)
-    = ((c3 + Zero) + (c4 + Zero))
-- Code(Expression(38, Sub)) at (prev + 1, 16) to (start + 0, 20)
-    = (((c3 + Zero) + (c4 + Zero)) - c6)
-- Code(Expression(37, Sub)) at (prev + 1, 20) to (start + 0, 25)
-    = ((((c3 + Zero) + (c4 + Zero)) - c6) - Zero)
+- Code(Expression(10, Sub)) at (prev + 3, 13) to (start + 0, 14)
+    = ((((c0 + c5) + c6) + Zero) - (c1 + c8))
+- Code(Expression(6, Sub)) at (prev + 0, 18) to (start + 0, 23)
+    = ((((c0 + c5) + c6) + Zero) - c1)
+- Code(Expression(10, Sub)) at (prev + 1, 16) to (start + 0, 20)
+    = ((((c0 + c5) + c6) + Zero) - (c1 + c8))
+- Code(Expression(24, Sub)) at (prev + 1, 20) to (start + 0, 25)
+    = (((c0 + c5) + c6) - (c1 + c8))
 - Code(Zero) at (prev + 1, 27) to (start + 0, 31)
 - Code(Zero) at (prev + 0, 32) to (start + 0, 34)
-- Code(Expression(17, Sub)) at (prev + 1, 17) to (start + 0, 18)
-    = (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)
-- Code(Expression(37, Sub)) at (prev + 1, 17) to (start + 0, 34)
-    = ((((c3 + Zero) + (c4 + Zero)) - c6) - Zero)
-- Code(Expression(36, Sub)) at (prev + 0, 34) to (start + 0, 35)
-    = (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - c4)
+- Code(Expression(19, Sub)) at (prev + 1, 17) to (start + 0, 18)
+    = (((c0 + c5) + c6) - ((c1 + c8) + Zero))
+- Code(Expression(24, Sub)) at (prev + 1, 17) to (start + 0, 34)
+    = (((c0 + c5) + c6) - (c1 + c8))
+- Code(Expression(28, Sub)) at (prev + 0, 34) to (start + 0, 35)
+    = ((c0 + c5) - (c1 + c8))
 - Code(Zero) at (prev + 1, 20) to (start + 1, 14)
-- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
-- Code(Expression(34, Add)) at (prev + 1, 5) to (start + 0, 6)
-    = ((c9 + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - c4)) + c6)
-Highest counter ID seen: c9
+- Code(Counter(8)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(31, Sub)) at (prev + 1, 5) to (start + 0, 6)
+    = (((c0 + c4) + c5) - c1)
+Highest counter ID seen: c8
 
 Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt
-Raw bytes (230): 0x[01, 01, 2b, 01, 00, 02, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, a7, 01, ab, 01, 00, 0d, 00, 15, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 9e, 01, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 9a, 01, 00, 9e, 01, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 9e, 01, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 9a, 01, 15, 9e, 01, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 93, 01, 25, 96, 01, 19, 9a, 01, 15, 9e, 01, 00, a3, 01, 19, a7, 01, ab, 01, 00, 0d, 00, 15, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 9e, 01, 02, 0d, 00, 0e, a3, 01, 00, 12, 00, 17, 9e, 01, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 9a, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 4a, 01, 11, 00, 12, 9a, 01, 01, 11, 00, 22, 96, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, 8f, 01, 01, 05, 00, 06]
+Raw bytes (152): 0x[01, 01, 18, 01, 00, 01, 00, 23, 15, 27, 11, 00, 0d, 27, 11, 00, 0d, 23, 15, 27, 11, 00, 0d, 4b, 15, 4f, 11, 00, 0d, 4b, 43, 4f, 11, 00, 0d, 15, 00, 4b, 15, 4f, 11, 00, 0d, 5f, 15, 00, 11, 5f, 21, 00, 11, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 21, 00, 1e, 00, 1f, 1e, 02, 0d, 00, 0e, 23, 00, 12, 00, 17, 1e, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 46, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 36, 01, 11, 00, 12, 46, 01, 11, 00, 22, 52, 00, 22, 00, 23, 15, 03, 09, 00, 0f, 5b, 01, 05, 00, 06]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 43
+Number of expressions: 24
 - expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 2 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 3 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
+- expression 1 operands: lhs = Counter(0), rhs = Zero
+- expression 2 operands: lhs = Expression(8, Add), rhs = Counter(5)
+- expression 3 operands: lhs = Expression(9, Add), rhs = Counter(4)
 - expression 4 operands: lhs = Zero, rhs = Counter(3)
-- expression 5 operands: lhs = Zero, rhs = Counter(5)
-- expression 6 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 7 operands: lhs = Zero, rhs = Counter(3)
-- expression 8 operands: lhs = Zero, rhs = Counter(5)
-- expression 9 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 10 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 11 operands: lhs = Zero, rhs = Counter(3)
-- expression 12 operands: lhs = Zero, rhs = Counter(5)
-- expression 13 operands: lhs = Expression(39, Sub), rhs = Zero
-- expression 14 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 15 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 16 operands: lhs = Zero, rhs = Counter(3)
-- expression 17 operands: lhs = Zero, rhs = Counter(5)
-- expression 18 operands: lhs = Expression(38, Sub), rhs = Zero
-- expression 19 operands: lhs = Expression(39, Sub), rhs = Zero
-- expression 20 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 21 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 22 operands: lhs = Zero, rhs = Counter(3)
-- expression 23 operands: lhs = Zero, rhs = Counter(5)
-- expression 24 operands: lhs = Expression(39, Sub), rhs = Zero
-- expression 25 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 26 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 27 operands: lhs = Zero, rhs = Counter(3)
-- expression 28 operands: lhs = Zero, rhs = Counter(5)
-- expression 29 operands: lhs = Expression(38, Sub), rhs = Counter(5)
-- expression 30 operands: lhs = Expression(39, Sub), rhs = Zero
-- expression 31 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 32 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 33 operands: lhs = Zero, rhs = Counter(3)
-- expression 34 operands: lhs = Zero, rhs = Counter(5)
-- expression 35 operands: lhs = Expression(36, Add), rhs = Counter(9)
-- expression 36 operands: lhs = Expression(37, Sub), rhs = Counter(6)
-- expression 37 operands: lhs = Expression(38, Sub), rhs = Counter(5)
-- expression 38 operands: lhs = Expression(39, Sub), rhs = Zero
-- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(6)
-- expression 40 operands: lhs = Expression(41, Add), rhs = Expression(42, Add)
-- expression 41 operands: lhs = Zero, rhs = Counter(3)
-- expression 42 operands: lhs = Zero, rhs = Counter(5)
+- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 6 operands: lhs = Zero, rhs = Counter(3)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(5)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 9 operands: lhs = Zero, rhs = Counter(3)
+- expression 10 operands: lhs = Expression(18, Add), rhs = Counter(5)
+- expression 11 operands: lhs = Expression(19, Add), rhs = Counter(4)
+- expression 12 operands: lhs = Zero, rhs = Counter(3)
+- expression 13 operands: lhs = Expression(18, Add), rhs = Expression(16, Add)
+- expression 14 operands: lhs = Expression(19, Add), rhs = Counter(4)
+- expression 15 operands: lhs = Zero, rhs = Counter(3)
+- expression 16 operands: lhs = Counter(5), rhs = Zero
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(5)
+- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(4)
+- expression 19 operands: lhs = Zero, rhs = Counter(3)
+- expression 20 operands: lhs = Expression(23, Add), rhs = Counter(5)
+- expression 21 operands: lhs = Zero, rhs = Counter(4)
+- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(8)
+- expression 23 operands: lhs = Zero, rhs = Counter(4)
 Number of file 0 mappings: 20
 - Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17)
 - Code(Zero) at (prev + 1, 18) to (start + 1, 10)
@@ -133,31 +106,31 @@ Number of file 0 mappings: 20
 - Code(Zero) at (prev + 1, 23) to (start + 0, 27)
 - Code(Zero) at (prev + 0, 28) to (start + 0, 30)
 - Code(Expression(1, Sub)) at (prev + 1, 13) to (start + 0, 14)
-    = ((c0 - Zero) - Zero)
+    = (c0 - Zero)
 - Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 30)
     = (c0 - Zero)
-- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
-- Code(Expression(39, Sub)) at (prev + 2, 13) to (start + 0, 14)
-    = (((Zero + c3) + (Zero + c5)) - c6)
-- Code(Expression(40, Add)) at (prev + 0, 18) to (start + 0, 23)
-    = ((Zero + c3) + (Zero + c5))
-- Code(Expression(39, Sub)) at (prev + 1, 16) to (start + 0, 21)
-    = (((Zero + c3) + (Zero + c5)) - c6)
+- Code(Counter(8)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Expression(7, Sub)) at (prev + 2, 13) to (start + 0, 14)
+    = (((Zero + c3) + c4) - c5)
+- Code(Expression(8, Add)) at (prev + 0, 18) to (start + 0, 23)
+    = ((Zero + c3) + c4)
+- Code(Expression(7, Sub)) at (prev + 1, 16) to (start + 0, 21)
+    = (((Zero + c3) + c4) - c5)
 - Code(Zero) at (prev + 0, 22) to (start + 1, 14)
-- Code(Expression(38, Sub)) at (prev + 2, 20) to (start + 0, 25)
-    = ((((Zero + c3) + (Zero + c5)) - c6) - Zero)
+- Code(Expression(17, Sub)) at (prev + 2, 20) to (start + 0, 25)
+    = (((Zero + c3) + c4) - c5)
 - Code(Zero) at (prev + 1, 27) to (start + 0, 31)
 - Code(Zero) at (prev + 0, 32) to (start + 0, 34)
-- Code(Expression(18, Sub)) at (prev + 1, 17) to (start + 0, 18)
-    = (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)
-- Code(Expression(38, Sub)) at (prev + 1, 17) to (start + 0, 34)
-    = ((((Zero + c3) + (Zero + c5)) - c6) - Zero)
-- Code(Expression(37, Sub)) at (prev + 0, 34) to (start + 0, 35)
-    = (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - c5)
-- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
-- Code(Expression(35, Add)) at (prev + 1, 5) to (start + 0, 6)
-    = (((((((Zero + c3) + (Zero + c5)) - c6) - Zero) - c5) + c6) + c9)
-Highest counter ID seen: c9
+- Code(Expression(13, Sub)) at (prev + 1, 17) to (start + 0, 18)
+    = (((Zero + c3) + c4) - (c5 + Zero))
+- Code(Expression(17, Sub)) at (prev + 1, 17) to (start + 0, 34)
+    = (((Zero + c3) + c4) - c5)
+- Code(Expression(20, Sub)) at (prev + 0, 34) to (start + 0, 35)
+    = ((Zero + c4) - c5)
+- Code(Counter(5)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(22, Add)) at (prev + 1, 5) to (start + 0, 6)
+    = ((Zero + c4) + c8)
+Highest counter ID seen: c8
 
 Function name: loops_branches::main
 Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02]
diff --git a/tests/coverage/mcdc/condition-limit.cov-map b/tests/coverage/mcdc/condition-limit.cov-map
index e3f5b49d363..19716878600 100644
--- a/tests/coverage/mcdc/condition-limit.cov-map
+++ b/tests/coverage/mcdc/condition-limit.cov-map
@@ -1,52 +1,54 @@
 Function name: condition_limit::accept_7_conditions
-Raw bytes (232): 0x[01, 01, 2c, 01, 05, 05, 1d, 05, 1d, 7a, 19, 05, 1d, 7a, 19, 05, 1d, 76, 15, 7a, 19, 05, 1d, 76, 15, 7a, 19, 05, 1d, 72, 11, 76, 15, 7a, 19, 05, 1d, 72, 11, 76, 15, 7a, 19, 05, 1d, 6e, 0d, 72, 11, 76, 15, 7a, 19, 05, 1d, 6e, 0d, 72, 11, 76, 15, 7a, 19, 05, 1d, 9f, 01, 02, a3, 01, 1d, a7, 01, 19, ab, 01, 15, af, 01, 11, 09, 0d, 21, 9b, 01, 9f, 01, 02, a3, 01, 1d, a7, 01, 19, ab, 01, 15, af, 01, 11, 09, 0d, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 7a, 1d, 07, 06, 00, 00, 0d, 00, 0e, 7a, 00, 12, 00, 13, 30, 76, 19, 06, 05, 00, 00, 12, 00, 13, 76, 00, 17, 00, 18, 30, 72, 15, 05, 04, 00, 00, 17, 00, 18, 72, 00, 1c, 00, 1d, 30, 6e, 11, 04, 03, 00, 00, 1c, 00, 1d, 6e, 00, 21, 00, 22, 30, 6a, 0d, 03, 02, 00, 00, 21, 00, 22, 6a, 00, 26, 00, 27, 30, 21, 09, 02, 00, 00, 00, 26, 00, 27, 21, 00, 28, 02, 06, 9b, 01, 02, 05, 00, 06, 97, 01, 01, 01, 00, 02]
+Raw bytes (237): 0x[01, 01, 2e, 01, 05, 05, 09, 05, 09, 05, 7b, 09, 0d, 05, 7b, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 77, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 73, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 05, 6f, 73, 19, 77, 15, 7b, 11, 09, 0d, 83, 01, 05, a7, 01, 21, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 9f, 01, 05, a3, 01, 21, a7, 01, 1d, ab, 01, 19, af, 01, 15, b3, 01, 11, b7, 01, 0d, 01, 09, 12, 01, 07, 01, 02, 09, 28, 08, 07, 02, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0a, 09, 07, 06, 00, 00, 0d, 00, 0e, 0a, 00, 12, 00, 13, 30, 16, 0d, 06, 05, 00, 00, 12, 00, 13, 16, 00, 17, 00, 18, 30, 2a, 11, 05, 04, 00, 00, 17, 00, 18, 2a, 00, 1c, 00, 1d, 30, 46, 15, 04, 03, 00, 00, 1c, 00, 1d, 46, 00, 21, 00, 22, 30, 6a, 19, 03, 02, 00, 00, 21, 00, 22, 6a, 00, 26, 00, 27, 30, 1d, 21, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 7e, 02, 05, 00, 06, 9a, 01, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 44
+Number of expressions: 46
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 3 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 5 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 6 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 7 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 8 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 9 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 10 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 11 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 12 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 13 operands: lhs = Expression(28, Sub), rhs = Counter(4)
-- expression 14 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 15 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 16 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 17 operands: lhs = Expression(28, Sub), rhs = Counter(4)
-- expression 18 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 19 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 20 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 21 operands: lhs = Expression(27, Sub), rhs = Counter(3)
-- expression 22 operands: lhs = Expression(28, Sub), rhs = Counter(4)
-- expression 23 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 24 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 25 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 26 operands: lhs = Expression(27, Sub), rhs = Counter(3)
-- expression 27 operands: lhs = Expression(28, Sub), rhs = Counter(4)
-- expression 28 operands: lhs = Expression(29, Sub), rhs = Counter(5)
-- expression 29 operands: lhs = Expression(30, Sub), rhs = Counter(6)
-- expression 30 operands: lhs = Counter(1), rhs = Counter(7)
-- expression 31 operands: lhs = Expression(39, Add), rhs = Expression(0, Sub)
-- expression 32 operands: lhs = Expression(40, Add), rhs = Counter(7)
-- expression 33 operands: lhs = Expression(41, Add), rhs = Counter(6)
-- expression 34 operands: lhs = Expression(42, Add), rhs = Counter(5)
-- expression 35 operands: lhs = Expression(43, Add), rhs = Counter(4)
-- expression 36 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 37 operands: lhs = Counter(8), rhs = Expression(38, Add)
-- expression 38 operands: lhs = Expression(39, Add), rhs = Expression(0, Sub)
-- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(7)
-- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(6)
-- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(5)
-- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(4)
-- expression 43 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(30, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(1), rhs = Expression(30, Add)
+- expression 6 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 7 operands: lhs = Counter(1), rhs = Expression(29, Add)
+- expression 8 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 9 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 10 operands: lhs = Counter(1), rhs = Expression(29, Add)
+- expression 11 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 13 operands: lhs = Counter(1), rhs = Expression(28, Add)
+- expression 14 operands: lhs = Expression(29, Add), rhs = Counter(5)
+- expression 15 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 16 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 17 operands: lhs = Counter(1), rhs = Expression(28, Add)
+- expression 18 operands: lhs = Expression(29, Add), rhs = Counter(5)
+- expression 19 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 20 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 21 operands: lhs = Counter(1), rhs = Expression(27, Add)
+- expression 22 operands: lhs = Expression(28, Add), rhs = Counter(6)
+- expression 23 operands: lhs = Expression(29, Add), rhs = Counter(5)
+- expression 24 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 25 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 26 operands: lhs = Counter(1), rhs = Expression(27, Add)
+- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(6)
+- expression 28 operands: lhs = Expression(29, Add), rhs = Counter(5)
+- expression 29 operands: lhs = Expression(30, Add), rhs = Counter(4)
+- expression 30 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(1)
+- expression 32 operands: lhs = Expression(41, Add), rhs = Counter(8)
+- expression 33 operands: lhs = Expression(42, Add), rhs = Counter(6)
+- expression 34 operands: lhs = Expression(43, Add), rhs = Counter(5)
+- expression 35 operands: lhs = Expression(44, Add), rhs = Counter(4)
+- expression 36 operands: lhs = Expression(45, Add), rhs = Counter(3)
+- expression 37 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 38 operands: lhs = Expression(39, Add), rhs = Counter(1)
+- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(8)
+- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(7)
+- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(6)
+- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(5)
+- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(4)
+- expression 44 operands: lhs = Expression(45, Add), rhs = Counter(3)
+- expression 45 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 18
 - Code(Counter(0)) at (prev + 7, 1) to (start + 2, 9)
 - MCDCDecision { bitmap_idx: 8, conditions_num: 7 } at (prev + 2, 8) to (start + 0, 39)
@@ -54,38 +56,38 @@ Number of file 0 mappings: 18
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
-- MCDCBranch { true: Expression(30, Sub), false: Counter(7), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
-    true  = (c1 - c7)
-    false = c7
-- Code(Expression(30, Sub)) at (prev + 0, 18) to (start + 0, 19)
-    = (c1 - c7)
-- MCDCBranch { true: Expression(29, Sub), false: Counter(6), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
-    true  = ((c1 - c7) - c6)
-    false = c6
-- Code(Expression(29, Sub)) at (prev + 0, 23) to (start + 0, 24)
-    = ((c1 - c7) - c6)
-- MCDCBranch { true: Expression(28, Sub), false: Counter(5), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
-    true  = (((c1 - c7) - c6) - c5)
-    false = c5
-- Code(Expression(28, Sub)) at (prev + 0, 28) to (start + 0, 29)
-    = (((c1 - c7) - c6) - c5)
-- MCDCBranch { true: Expression(27, Sub), false: Counter(4), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29)
-    true  = ((((c1 - c7) - c6) - c5) - c4)
-    false = c4
-- Code(Expression(27, Sub)) at (prev + 0, 33) to (start + 0, 34)
-    = ((((c1 - c7) - c6) - c5) - c4)
-- MCDCBranch { true: Expression(26, Sub), false: Counter(3), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34)
-    true  = (((((c1 - c7) - c6) - c5) - c4) - c3)
+- MCDCBranch { true: Expression(2, Sub), false: Counter(2), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+    true  = (c1 - c2)
+    false = c2
+- Code(Expression(2, Sub)) at (prev + 0, 18) to (start + 0, 19)
+    = (c1 - c2)
+- MCDCBranch { true: Expression(5, Sub), false: Counter(3), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
+    true  = (c1 - (c2 + c3))
     false = c3
+- Code(Expression(5, Sub)) at (prev + 0, 23) to (start + 0, 24)
+    = (c1 - (c2 + c3))
+- MCDCBranch { true: Expression(10, Sub), false: Counter(4), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
+    true  = (c1 - ((c2 + c3) + c4))
+    false = c4
+- Code(Expression(10, Sub)) at (prev + 0, 28) to (start + 0, 29)
+    = (c1 - ((c2 + c3) + c4))
+- MCDCBranch { true: Expression(17, Sub), false: Counter(5), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29)
+    true  = (c1 - (((c2 + c3) + c4) + c5))
+    false = c5
+- Code(Expression(17, Sub)) at (prev + 0, 33) to (start + 0, 34)
+    = (c1 - (((c2 + c3) + c4) + c5))
+- MCDCBranch { true: Expression(26, Sub), false: Counter(6), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34)
+    true  = (c1 - ((((c2 + c3) + c4) + c5) + c6))
+    false = c6
 - Code(Expression(26, Sub)) at (prev + 0, 38) to (start + 0, 39)
-    = (((((c1 - c7) - c6) - c5) - c4) - c3)
-- MCDCBranch { true: Counter(8), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39)
-    true  = c8
-    false = c2
-- Code(Counter(8)) at (prev + 0, 40) to (start + 2, 6)
-- Code(Expression(38, Add)) at (prev + 2, 5) to (start + 0, 6)
-    = ((((((c2 + c3) + c4) + c5) + c6) + c7) + (c0 - c1))
-- Code(Expression(37, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = (c8 + ((((((c2 + c3) + c4) + c5) + c6) + c7) + (c0 - c1)))
+    = (c1 - ((((c2 + c3) + c4) + c5) + c6))
+- MCDCBranch { true: Counter(7), false: Counter(8), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39)
+    true  = c7
+    false = c8
+- Code(Counter(7)) at (prev + 0, 40) to (start + 2, 6)
+- Code(Expression(31, Sub)) at (prev + 2, 5) to (start + 0, 6)
+    = (((((((c0 + c2) + c3) + c4) + c5) + c6) + c8) - c1)
+- Code(Expression(38, Sub)) at (prev + 1, 1) to (start + 0, 2)
+    = ((((((((c0 + c2) + c3) + c4) + c5) + c6) + c7) + c8) - c1)
 Highest counter ID seen: c8
 
diff --git a/tests/coverage/mcdc/if.cov-map b/tests/coverage/mcdc/if.cov-map
index c0e7d08bb02..acb8aac63de 100644
--- a/tests/coverage/mcdc/if.cov-map
+++ b/tests/coverage/mcdc/if.cov-map
@@ -1,12 +1,14 @@
 Function name: if::mcdc_check_a
-Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 0f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 6
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
@@ -14,25 +16,27 @@ Number of file 0 mappings: 8
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
-    true  = c3
-    false = c2
-- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+    true  = c2
+    false = c3
+- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c3) - c1)
+- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: if::mcdc_check_b
-Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 17, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 6
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 23, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
@@ -40,25 +44,27 @@ Number of file 0 mappings: 8
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
-    true  = c3
-    false = c2
-- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+    true  = c2
+    false = c3
+- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c3) - c1)
+- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: if::mcdc_check_both
-Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 1f, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 6
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 31, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
@@ -66,25 +72,27 @@ Number of file 0 mappings: 8
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
-    true  = c3
-    false = c2
-- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+    true  = c2
+    false = c3
+- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c3) - c1)
+- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: if::mcdc_check_neither
-Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
+Raw bytes (68): 0x[01, 01, 06, 01, 05, 0b, 05, 01, 0d, 13, 05, 17, 0d, 01, 09, 08, 01, 07, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 0d, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 06, 02, 0c, 02, 06, 0e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 6
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
@@ -92,29 +100,32 @@ Number of file 0 mappings: 8
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
-    true  = c3
-    false = c2
-- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+    true  = c2
+    false = c3
+- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c3) - c1)
+- Code(Expression(3, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: if::mcdc_check_not_tree_decision
-Raw bytes (87): 0x[01, 01, 08, 01, 05, 02, 09, 05, 09, 0d, 1e, 02, 09, 11, 1b, 0d, 1e, 02, 09, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 1e, 03, 02, 00, 00, 0e, 00, 0f, 0b, 00, 14, 00, 15, 30, 11, 0d, 02, 00, 00, 00, 14, 00, 15, 11, 00, 16, 02, 06, 1b, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
+Raw bytes (93): 0x[01, 01, 0b, 01, 05, 01, 2b, 05, 09, 05, 09, 17, 2b, 01, 11, 05, 09, 23, 2b, 27, 11, 01, 0d, 05, 09, 0a, 01, 31, 01, 03, 0a, 28, 05, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 2b, 00, 14, 00, 15, 30, 0d, 11, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 8
+Number of expressions: 11
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Expression(10, Add)
 - expression 2 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Sub)
-- expression 4 operands: lhs = Expression(0, Sub), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(4), rhs = Expression(6, Add)
-- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Sub)
-- expression 7 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Expression(10, Add)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 6 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(10, Add)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 10 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 10
 - Code(Counter(0)) at (prev + 49, 1) to (start + 3, 10)
 - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
@@ -123,34 +134,36 @@ Number of file 0 mappings: 10
     false = (c0 - c1)
 - Code(Expression(0, Sub)) at (prev + 0, 14) to (start + 0, 15)
     = (c0 - c1)
-- MCDCBranch { true: Counter(2), false: Expression(7, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15)
+- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15)
     true  = c2
-    false = ((c0 - c1) - c2)
-- Code(Expression(2, Add)) at (prev + 0, 20) to (start + 0, 21)
+    false = (c0 - (c1 + c2))
+- Code(Expression(10, Add)) at (prev + 0, 20) to (start + 0, 21)
     = (c1 + c2)
-- MCDCBranch { true: Counter(4), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21)
-    true  = c4
-    false = c3
-- Code(Counter(4)) at (prev + 0, 22) to (start + 2, 6)
-- Code(Expression(6, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c3 + ((c0 - c1) - c2))
-- Code(Expression(5, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c4 + (c3 + ((c0 - c1) - c2)))
+- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21)
+    true  = c3
+    false = c4
+- Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6)
+- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c4) - (c1 + c2))
+- Code(Expression(7, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c3) + c4) - (c1 + c2))
 Highest counter ID seen: c4
 
 Function name: if::mcdc_check_tree_decision
-Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 0d, 05, 0d, 0d, 11, 09, 02, 1b, 1f, 0d, 11, 09, 02, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 0d, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 11, 09, 03, 00, 00, 00, 13, 00, 14, 1b, 00, 16, 02, 06, 1f, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
+Raw bytes (91): 0x[01, 01, 0a, 01, 05, 05, 09, 05, 09, 09, 0d, 17, 05, 01, 11, 1f, 05, 23, 11, 27, 0d, 01, 09, 0a, 01, 27, 01, 03, 09, 28, 04, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 11, 03, 00, 00, 00, 13, 00, 14, 0f, 00, 16, 02, 06, 12, 02, 0c, 02, 06, 1a, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 8
+Number of expressions: 10
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 4 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 5 operands: lhs = Expression(6, Add), rhs = Expression(7, Add)
-- expression 6 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 7 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(1)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(1)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(4)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(3)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 10
 - Code(Counter(0)) at (prev + 39, 1) to (start + 3, 9)
 - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
@@ -158,40 +171,43 @@ Number of file 0 mappings: 10
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15)
-- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 2, true_next_id: 0, false_next_id: 3 } at (prev + 0, 14) to (start + 0, 15)
-    true  = c3
-    false = (c1 - c3)
+- MCDCBranch { true: Counter(2), false: Expression(2, Sub), condition_id: 2, true_next_id: 0, false_next_id: 3 } at (prev + 0, 14) to (start + 0, 15)
+    true  = c2
+    false = (c1 - c2)
 - Code(Expression(2, Sub)) at (prev + 0, 19) to (start + 0, 20)
-    = (c1 - c3)
-- MCDCBranch { true: Counter(4), false: Counter(2), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20)
-    true  = c4
-    false = c2
-- Code(Expression(6, Add)) at (prev + 0, 22) to (start + 2, 6)
-    = (c3 + c4)
-- Code(Expression(7, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(5, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = ((c3 + c4) + (c2 + (c0 - c1)))
+    = (c1 - c2)
+- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20)
+    true  = c3
+    false = c4
+- Code(Expression(3, Add)) at (prev + 0, 22) to (start + 2, 6)
+    = (c2 + c3)
+- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c4) - c1)
+- Code(Expression(6, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = ((((c0 + c2) + c3) + c4) - c1)
 Highest counter ID seen: c4
 
 Function name: if::mcdc_nested_if
-Raw bytes (124): 0x[01, 01, 0d, 01, 05, 02, 09, 05, 09, 1b, 15, 05, 09, 1b, 15, 05, 09, 11, 15, 02, 09, 2b, 32, 0d, 2f, 11, 15, 02, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 32, 02, 00, 00, 00, 0d, 00, 0e, 1b, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 16, 15, 01, 02, 00, 00, 0c, 00, 0d, 16, 00, 11, 00, 12, 30, 0d, 11, 02, 00, 00, 00, 11, 00, 12, 0d, 00, 13, 02, 0a, 2f, 02, 09, 00, 0a, 32, 01, 0c, 02, 06, 27, 03, 01, 00, 02]
+Raw bytes (130): 0x[01, 01, 10, 01, 05, 01, 3f, 05, 09, 05, 09, 3f, 0d, 05, 09, 3f, 0d, 05, 09, 0d, 15, 01, 3f, 05, 09, 33, 3f, 37, 15, 3b, 11, 01, 0d, 05, 09, 0e, 01, 3b, 01, 01, 09, 28, 03, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 26, 02, 00, 00, 00, 0d, 00, 0e, 3f, 01, 09, 01, 0d, 28, 06, 02, 01, 0c, 00, 12, 30, 1a, 0d, 01, 02, 00, 00, 0c, 00, 0d, 1a, 00, 11, 00, 12, 30, 11, 15, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 23, 02, 09, 00, 0a, 26, 01, 0c, 02, 06, 2e, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 13
+Number of expressions: 16
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Expression(15, Add)
 - expression 2 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 3 operands: lhs = Expression(6, Add), rhs = Counter(5)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(5)
-- expression 6 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 8 operands: lhs = Expression(0, Sub), rhs = Counter(2)
-- expression 9 operands: lhs = Expression(10, Add), rhs = Expression(12, Sub)
-- expression 10 operands: lhs = Counter(3), rhs = Expression(11, Add)
-- expression 11 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 12 operands: lhs = Expression(0, Sub), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(15, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 6 operands: lhs = Expression(15, Add), rhs = Counter(3)
+- expression 7 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 8 operands: lhs = Counter(3), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(0), rhs = Expression(15, Add)
+- expression 10 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Expression(15, Add)
+- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(5)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(4)
+- expression 14 operands: lhs = Counter(0), rhs = Counter(3)
+- expression 15 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 14
 - Code(Counter(0)) at (prev + 59, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
@@ -200,26 +216,26 @@ Number of file 0 mappings: 14
     false = (c0 - c1)
 - Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 14)
     = (c0 - c1)
-- MCDCBranch { true: Counter(2), false: Expression(12, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
+- MCDCBranch { true: Counter(2), false: Expression(9, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
     true  = c2
-    false = ((c0 - c1) - c2)
-- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 1, 13)
+    false = (c0 - (c1 + c2))
+- Code(Expression(15, Add)) at (prev + 1, 9) to (start + 1, 13)
     = (c1 + c2)
 - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 1, 12) to (start + 0, 18)
-- MCDCBranch { true: Expression(5, Sub), false: Counter(5), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13)
-    true  = ((c1 + c2) - c5)
+- MCDCBranch { true: Expression(6, Sub), false: Counter(3), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13)
+    true  = ((c1 + c2) - c3)
+    false = c3
+- Code(Expression(6, Sub)) at (prev + 0, 17) to (start + 0, 18)
+    = ((c1 + c2) - c3)
+- MCDCBranch { true: Counter(4), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18)
+    true  = c4
     false = c5
-- Code(Expression(5, Sub)) at (prev + 0, 17) to (start + 0, 18)
-    = ((c1 + c2) - c5)
-- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18)
-    true  = c3
-    false = c4
-- Code(Counter(3)) at (prev + 0, 19) to (start + 2, 10)
-- Code(Expression(11, Add)) at (prev + 2, 9) to (start + 0, 10)
-    = (c4 + c5)
-- Code(Expression(12, Sub)) at (prev + 1, 12) to (start + 2, 6)
-    = ((c0 - c1) - c2)
-- Code(Expression(9, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = ((c3 + (c4 + c5)) + ((c0 - c1) - c2))
+- Code(Counter(4)) at (prev + 0, 19) to (start + 2, 10)
+- Code(Expression(8, Add)) at (prev + 2, 9) to (start + 0, 10)
+    = (c3 + c5)
+- Code(Expression(9, Sub)) at (prev + 1, 12) to (start + 2, 6)
+    = (c0 - (c1 + c2))
+- Code(Expression(11, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = ((((c0 + c3) + c4) + c5) - (c1 + c2))
 Highest counter ID seen: c5
 
diff --git a/tests/coverage/mcdc/inlined_expressions.cov-map b/tests/coverage/mcdc/inlined_expressions.cov-map
index 4f44e0f2b85..92ec60dc23c 100644
--- a/tests/coverage/mcdc/inlined_expressions.cov-map
+++ b/tests/coverage/mcdc/inlined_expressions.cov-map
@@ -1,11 +1,12 @@
 Function name: inlined_expressions::inlined_instance
-Raw bytes (52): 0x[01, 01, 03, 01, 05, 0b, 02, 09, 0d, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 0d, 02, 00, 00, 00, 0a, 00, 0b, 07, 01, 01, 00, 02]
+Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 08, 01, 01, 06, 28, 03, 02, 01, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 0d, 02, 00, 00, 00, 0a, 00, 0b, 06, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 3
+Number of expressions: 4
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 6
 - Code(Counter(0)) at (prev + 8, 1) to (start + 1, 6)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 5) to (start + 0, 11)
@@ -16,7 +17,7 @@ Number of file 0 mappings: 6
 - MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11)
     true  = c2
     false = c3
-- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
diff --git a/tests/coverage/mcdc/nested_if.cov-map b/tests/coverage/mcdc/nested_if.cov-map
index 3bed49e7a12..72daecabc77 100644
--- a/tests/coverage/mcdc/nested_if.cov-map
+++ b/tests/coverage/mcdc/nested_if.cov-map
@@ -1,205 +1,213 @@
 Function name: nested_if::doubly_nested_if_in_condition
-Raw bytes (168): 0x[01, 01, 0e, 01, 05, 05, 11, 05, 11, 26, 19, 05, 11, 19, 1d, 19, 1d, 1d, 22, 26, 19, 05, 11, 11, 15, 09, 02, 0d, 37, 09, 02, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 11, 26, 01, 00, 02, 00, 10, 00, 11, 30, 15, 21, 02, 00, 00, 00, 15, 00, 36, 26, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 22, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1a, 1d, 02, 00, 00, 00, 1d, 00, 1e, 1a, 00, 21, 00, 25, 1f, 00, 2f, 00, 34, 2b, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 0d, 00, 4f, 02, 06, 37, 02, 0c, 02, 06, 33, 03, 01, 00, 02]
+Raw bytes (172): 0x[01, 01, 10, 01, 05, 05, 09, 05, 09, 05, 27, 09, 19, 19, 1d, 19, 1d, 23, 27, 05, 1d, 09, 19, 09, 0d, 33, 05, 01, 15, 3b, 05, 3f, 15, 01, 11, 14, 01, 0f, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 21, 02, 00, 00, 00, 15, 00, 36, 0a, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 19, 0e, 01, 02, 00, 00, 18, 00, 19, 19, 00, 1d, 00, 1e, 30, 1a, 1d, 02, 00, 00, 00, 1d, 00, 1e, 1a, 00, 21, 00, 25, 1e, 00, 2f, 00, 34, 2b, 00, 39, 00, 3e, 21, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 2e, 02, 0c, 02, 06, 36, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 14
+Number of expressions: 16
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 3 operands: lhs = Expression(9, Sub), rhs = Counter(6)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(9, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(6)
 - expression 5 operands: lhs = Counter(6), rhs = Counter(7)
 - expression 6 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 7 operands: lhs = Counter(7), rhs = Expression(8, Sub)
-- expression 8 operands: lhs = Expression(9, Sub), rhs = Counter(6)
-- expression 9 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 11 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 12 operands: lhs = Counter(3), rhs = Expression(13, Add)
-- expression 13 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Expression(9, Add)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(7)
+- expression 9 operands: lhs = Counter(2), rhs = Counter(6)
+- expression 10 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(1)
+- expression 12 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(1)
+- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(5)
+- expression 15 operands: lhs = Counter(0), rhs = Counter(4)
 Number of file 0 mappings: 20
 - Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 78)
 - MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
     true  = c1
     false = (c0 - c1)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 78)
-    true  = c3
-    false = c2
+- MCDCBranch { true: Counter(4), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 78)
+    true  = c4
+    false = c5
 - Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17)
 - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 54)
-- MCDCBranch { true: Counter(4), false: Expression(9, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
-    true  = c4
-    false = (c1 - c4)
-- MCDCBranch { true: Counter(5), false: Counter(8), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 54)
-    true  = c5
+- MCDCBranch { true: Counter(2), false: Expression(2, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
+    true  = c2
+    false = (c1 - c2)
+- MCDCBranch { true: Counter(3), false: Counter(8), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 54)
+    true  = c3
     false = c8
-- Code(Expression(9, Sub)) at (prev + 0, 24) to (start + 0, 25)
-    = (c1 - c4)
+- Code(Expression(2, Sub)) at (prev + 0, 24) to (start + 0, 25)
+    = (c1 - c2)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 24) to (start + 0, 30)
-- MCDCBranch { true: Counter(6), false: Expression(8, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 24) to (start + 0, 25)
+- MCDCBranch { true: Counter(6), false: Expression(3, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 24) to (start + 0, 25)
     true  = c6
-    false = ((c1 - c4) - c6)
+    false = (c1 - (c2 + c6))
 - Code(Counter(6)) at (prev + 0, 29) to (start + 0, 30)
 - MCDCBranch { true: Expression(6, Sub), false: Counter(7), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30)
     true  = (c6 - c7)
     false = c7
 - Code(Expression(6, Sub)) at (prev + 0, 33) to (start + 0, 37)
     = (c6 - c7)
-- Code(Expression(7, Add)) at (prev + 0, 47) to (start + 0, 52)
-    = (c7 + ((c1 - c4) - c6))
+- Code(Expression(7, Sub)) at (prev + 0, 47) to (start + 0, 52)
+    = ((c1 + c7) - (c2 + c6))
 - Code(Expression(10, Add)) at (prev + 0, 57) to (start + 0, 62)
-    = (c4 + c5)
+    = (c2 + c3)
 - Code(Counter(8)) at (prev + 0, 72) to (start + 0, 76)
-- Code(Counter(3)) at (prev + 0, 79) to (start + 2, 6)
-- Code(Expression(13, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(12, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- Code(Counter(4)) at (prev + 0, 79) to (start + 2, 6)
+- Code(Expression(11, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c5) - c1)
+- Code(Expression(13, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c4) + c5) - c1)
 Highest counter ID seen: c8
 
 Function name: nested_if::nested_if_in_condition
-Raw bytes (120): 0x[01, 01, 0b, 01, 05, 05, 11, 05, 11, 1e, 15, 05, 11, 11, 15, 1e, 15, 05, 11, 09, 02, 0d, 2b, 09, 02, 0e, 01, 07, 01, 01, 09, 28, 06, 02, 01, 08, 00, 2e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 2e, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 11, 1e, 01, 00, 02, 00, 10, 00, 11, 1e, 00, 15, 00, 16, 30, 15, 1a, 02, 00, 00, 00, 15, 00, 16, 17, 00, 19, 00, 1d, 1a, 00, 27, 00, 2c, 0d, 00, 2f, 02, 06, 2b, 02, 0c, 02, 06, 27, 03, 01, 00, 02]
+Raw bytes (124): 0x[01, 01, 0d, 01, 05, 05, 09, 05, 09, 05, 1f, 09, 0d, 09, 0d, 05, 1f, 09, 0d, 27, 05, 01, 15, 2f, 05, 33, 15, 01, 11, 0e, 01, 07, 01, 01, 09, 28, 06, 02, 01, 08, 00, 2e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 15, 02, 00, 00, 00, 0d, 00, 2e, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 1a, 02, 00, 00, 00, 15, 00, 16, 1f, 00, 19, 00, 1d, 1a, 00, 27, 00, 2c, 11, 00, 2f, 02, 06, 22, 02, 0c, 02, 06, 2a, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 11
+Number of expressions: 13
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 3 operands: lhs = Expression(7, Sub), rhs = Counter(5)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 5 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(5)
-- expression 7 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 8 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 9 operands: lhs = Counter(3), rhs = Expression(10, Add)
-- expression 10 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(1)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(5)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(1)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(0), rhs = Counter(4)
 Number of file 0 mappings: 14
 - Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 46)
 - MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
     true  = c1
     false = (c0 - c1)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 46)
-    true  = c3
-    false = c2
+- MCDCBranch { true: Counter(4), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 46)
+    true  = c4
+    false = c5
 - Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 22)
-- MCDCBranch { true: Counter(4), false: Expression(7, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
-    true  = c4
-    false = (c1 - c4)
-- Code(Expression(7, Sub)) at (prev + 0, 21) to (start + 0, 22)
-    = (c1 - c4)
-- MCDCBranch { true: Counter(5), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22)
-    true  = c5
-    false = ((c1 - c4) - c5)
-- Code(Expression(5, Add)) at (prev + 0, 25) to (start + 0, 29)
-    = (c4 + c5)
+- MCDCBranch { true: Counter(2), false: Expression(2, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
+    true  = c2
+    false = (c1 - c2)
+- Code(Expression(2, Sub)) at (prev + 0, 21) to (start + 0, 22)
+    = (c1 - c2)
+- MCDCBranch { true: Counter(3), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22)
+    true  = c3
+    false = (c1 - (c2 + c3))
+- Code(Expression(7, Add)) at (prev + 0, 25) to (start + 0, 29)
+    = (c2 + c3)
 - Code(Expression(6, Sub)) at (prev + 0, 39) to (start + 0, 44)
-    = ((c1 - c4) - c5)
-- Code(Counter(3)) at (prev + 0, 47) to (start + 2, 6)
-- Code(Expression(10, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(9, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+    = (c1 - (c2 + c3))
+- Code(Counter(4)) at (prev + 0, 47) to (start + 2, 6)
+- Code(Expression(8, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c5) - c1)
+- Code(Expression(10, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c4) + c5) - c1)
 Highest counter ID seen: c5
 
 Function name: nested_if::nested_in_then_block_in_condition
-Raw bytes (176): 0x[01, 01, 12, 01, 05, 05, 11, 05, 11, 3a, 15, 05, 11, 11, 15, 33, 19, 11, 15, 19, 1d, 19, 1d, 1d, 2e, 33, 19, 11, 15, 3a, 15, 05, 11, 09, 02, 0d, 47, 09, 02, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 11, 3a, 01, 00, 02, 00, 10, 00, 11, 3a, 00, 15, 00, 16, 30, 15, 36, 02, 00, 00, 00, 15, 00, 16, 33, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 19, 2e, 01, 02, 00, 00, 1c, 00, 1d, 19, 00, 21, 00, 22, 30, 26, 1d, 02, 00, 00, 00, 21, 00, 22, 26, 00, 25, 00, 29, 2b, 00, 33, 00, 38, 36, 00, 44, 00, 49, 0d, 00, 4c, 02, 06, 47, 02, 0c, 02, 06, 43, 03, 01, 00, 02]
+Raw bytes (180): 0x[01, 01, 14, 01, 05, 05, 09, 05, 09, 05, 3b, 09, 0d, 09, 0d, 3b, 11, 09, 0d, 11, 15, 11, 15, 2f, 11, 3b, 15, 09, 0d, 05, 3b, 09, 0d, 43, 05, 01, 1d, 4b, 05, 4f, 1d, 01, 19, 14, 01, 22, 01, 01, 09, 28, 09, 02, 01, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 1d, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0a, 01, 00, 02, 00, 10, 00, 11, 0a, 00, 15, 00, 16, 30, 0d, 36, 02, 00, 00, 00, 15, 00, 16, 3b, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1a, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 26, 15, 02, 00, 00, 00, 21, 00, 22, 26, 00, 25, 00, 29, 2a, 00, 33, 00, 38, 36, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 3e, 02, 0c, 02, 06, 46, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 18
+Number of expressions: 20
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 3 operands: lhs = Expression(14, Sub), rhs = Counter(5)
-- expression 4 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 5 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 6 operands: lhs = Expression(12, Add), rhs = Counter(6)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 8 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 9 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 10 operands: lhs = Counter(7), rhs = Expression(11, Sub)
-- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(6)
-- expression 12 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 13 operands: lhs = Expression(14, Sub), rhs = Counter(5)
-- expression 14 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 15 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 16 operands: lhs = Counter(3), rhs = Expression(17, Add)
-- expression 17 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(14, Add)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 6 operands: lhs = Expression(14, Add), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 9 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(4)
+- expression 11 operands: lhs = Expression(14, Add), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 13 operands: lhs = Counter(1), rhs = Expression(14, Add)
+- expression 14 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 15 operands: lhs = Expression(16, Add), rhs = Counter(1)
+- expression 16 operands: lhs = Counter(0), rhs = Counter(7)
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(1)
+- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(7)
+- expression 19 operands: lhs = Counter(0), rhs = Counter(6)
 Number of file 0 mappings: 20
 - Code(Counter(0)) at (prev + 34, 1) to (start + 1, 9)
 - MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 75)
 - MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
     true  = c1
     false = (c0 - c1)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 75)
-    true  = c3
-    false = c2
+- MCDCBranch { true: Counter(6), false: Counter(7), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 75)
+    true  = c6
+    false = c7
 - Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 22)
-- MCDCBranch { true: Counter(4), false: Expression(14, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
-    true  = c4
-    false = (c1 - c4)
-- Code(Expression(14, Sub)) at (prev + 0, 21) to (start + 0, 22)
-    = (c1 - c4)
-- MCDCBranch { true: Counter(5), false: Expression(13, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22)
-    true  = c5
-    false = ((c1 - c4) - c5)
-- Code(Expression(12, Add)) at (prev + 0, 28) to (start + 0, 29)
-    = (c4 + c5)
+- MCDCBranch { true: Counter(2), false: Expression(2, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17)
+    true  = c2
+    false = (c1 - c2)
+- Code(Expression(2, Sub)) at (prev + 0, 21) to (start + 0, 22)
+    = (c1 - c2)
+- MCDCBranch { true: Counter(3), false: Expression(13, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22)
+    true  = c3
+    false = (c1 - (c2 + c3))
+- Code(Expression(14, Add)) at (prev + 0, 28) to (start + 0, 29)
+    = (c2 + c3)
 - MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 28) to (start + 0, 34)
-- MCDCBranch { true: Counter(6), false: Expression(11, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29)
-    true  = c6
-    false = ((c4 + c5) - c6)
-- Code(Counter(6)) at (prev + 0, 33) to (start + 0, 34)
-- MCDCBranch { true: Expression(9, Sub), false: Counter(7), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34)
-    true  = (c6 - c7)
-    false = c7
+- MCDCBranch { true: Counter(4), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29)
+    true  = c4
+    false = ((c2 + c3) - c4)
+- Code(Counter(4)) at (prev + 0, 33) to (start + 0, 34)
+- MCDCBranch { true: Expression(9, Sub), false: Counter(5), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34)
+    true  = (c4 - c5)
+    false = c5
 - Code(Expression(9, Sub)) at (prev + 0, 37) to (start + 0, 41)
-    = (c6 - c7)
-- Code(Expression(10, Add)) at (prev + 0, 51) to (start + 0, 56)
-    = (c7 + ((c4 + c5) - c6))
+    = (c4 - c5)
+- Code(Expression(10, Sub)) at (prev + 0, 51) to (start + 0, 56)
+    = (((c2 + c3) + c5) - c4)
 - Code(Expression(13, Sub)) at (prev + 0, 68) to (start + 0, 73)
-    = ((c1 - c4) - c5)
-- Code(Counter(3)) at (prev + 0, 76) to (start + 2, 6)
-- Code(Expression(17, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(16, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+    = (c1 - (c2 + c3))
+- Code(Counter(6)) at (prev + 0, 76) to (start + 2, 6)
+- Code(Expression(15, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c7) - c1)
+- Code(Expression(17, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c6) + c7) - c1)
 Highest counter ID seen: c7
 
 Function name: nested_if::nested_single_condition_decision
-Raw bytes (85): 0x[01, 01, 06, 01, 05, 05, 11, 05, 11, 09, 02, 0d, 17, 09, 02, 0b, 01, 17, 01, 04, 09, 28, 03, 02, 04, 08, 00, 29, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 29, 05, 00, 10, 00, 11, 20, 11, 0a, 00, 10, 00, 11, 11, 00, 14, 00, 19, 0a, 00, 23, 00, 27, 0d, 00, 2a, 02, 06, 17, 02, 0c, 02, 06, 13, 03, 01, 00, 02]
+Raw bytes (89): 0x[01, 01, 08, 01, 05, 05, 09, 05, 09, 13, 05, 01, 11, 1b, 05, 1f, 11, 01, 0d, 0b, 01, 17, 01, 04, 09, 28, 03, 02, 04, 08, 00, 29, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 11, 02, 00, 00, 00, 0d, 00, 29, 05, 00, 10, 00, 11, 20, 09, 0a, 00, 10, 00, 11, 09, 00, 14, 00, 19, 0a, 00, 23, 00, 27, 0d, 00, 2a, 02, 06, 0e, 02, 0c, 02, 06, 16, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 6
+Number of expressions: 8
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(1), rhs = Counter(4)
-- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
-- expression 4 operands: lhs = Counter(3), rhs = Expression(5, Add)
-- expression 5 operands: lhs = Counter(2), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(1)
+- expression 4 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(1)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(0), rhs = Counter(3)
 Number of file 0 mappings: 11
 - Code(Counter(0)) at (prev + 23, 1) to (start + 4, 9)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 4, 8) to (start + 0, 41)
 - MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
     true  = c1
     false = (c0 - c1)
-- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 41)
+- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 41)
     true  = c3
-    false = c2
+    false = c4
 - Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17)
-- Branch { true: Counter(4), false: Expression(2, Sub) } at (prev + 0, 16) to (start + 0, 17)
-    true  = c4
-    false = (c1 - c4)
-- Code(Counter(4)) at (prev + 0, 20) to (start + 0, 25)
+- Branch { true: Counter(2), false: Expression(2, Sub) } at (prev + 0, 16) to (start + 0, 17)
+    true  = c2
+    false = (c1 - c2)
+- Code(Counter(2)) at (prev + 0, 20) to (start + 0, 25)
 - Code(Expression(2, Sub)) at (prev + 0, 35) to (start + 0, 39)
-    = (c1 - c4)
+    = (c1 - c2)
 - Code(Counter(3)) at (prev + 0, 42) to (start + 2, 6)
-- Code(Expression(5, Add)) at (prev + 2, 12) to (start + 2, 6)
-    = (c2 + (c0 - c1))
-- Code(Expression(4, Add)) at (prev + 3, 1) to (start + 0, 2)
-    = (c3 + (c2 + (c0 - c1)))
+- Code(Expression(3, Sub)) at (prev + 2, 12) to (start + 2, 6)
+    = ((c0 + c4) - c1)
+- Code(Expression(5, Sub)) at (prev + 3, 1) to (start + 0, 2)
+    = (((c0 + c3) + c4) - c1)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/mcdc/non_control_flow.cov-map b/tests/coverage/mcdc/non_control_flow.cov-map
index 677e31e404e..0edeff9a586 100644
--- a/tests/coverage/mcdc/non_control_flow.cov-map
+++ b/tests/coverage/mcdc/non_control_flow.cov-map
@@ -1,67 +1,65 @@
 Function name: non_control_flow::assign_3
-Raw bytes (89): 0x[01, 01, 09, 05, 07, 0b, 11, 09, 0d, 01, 05, 01, 05, 22, 11, 01, 05, 22, 11, 01, 05, 0a, 01, 16, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 22, 01, 00, 02, 00, 0d, 00, 0e, 22, 00, 12, 00, 13, 30, 1e, 11, 02, 03, 00, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 30, 09, 0d, 03, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
+Raw bytes (89): 0x[01, 01, 09, 07, 11, 0b, 0d, 05, 09, 01, 05, 01, 05, 01, 23, 05, 11, 01, 23, 05, 11, 0a, 01, 16, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 12, 01, 00, 02, 00, 0d, 00, 0e, 12, 00, 12, 00, 13, 30, 1e, 11, 02, 03, 00, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 30, 09, 0d, 03, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 9
-- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(4)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
 - expression 3 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 4 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 5 operands: lhs = Expression(8, Sub), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(4)
-- expression 8 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 5 operands: lhs = Counter(0), rhs = Expression(8, Add)
+- expression 6 operands: lhs = Counter(1), rhs = Counter(4)
+- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(4)
 Number of file 0 mappings: 10
 - Code(Counter(0)) at (prev + 22, 1) to (start + 0, 40)
 - Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
-    = (c1 + ((c2 + c3) + c4))
+    = (((c1 + c2) + c3) + c4)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
 - MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24)
-- MCDCBranch { true: Counter(1), false: Expression(8, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
+- MCDCBranch { true: Counter(1), false: Expression(4, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
     false = (c0 - c1)
-- Code(Expression(8, Sub)) at (prev + 0, 18) to (start + 0, 19)
+- Code(Expression(4, Sub)) at (prev + 0, 18) to (start + 0, 19)
     = (c0 - c1)
 - MCDCBranch { true: Expression(7, Sub), false: Counter(4), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
-    true  = ((c0 - c1) - c4)
+    true  = (c0 - (c1 + c4))
     false = c4
 - Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24)
-    = ((c0 - c1) - c4)
+    = (c0 - (c1 + c4))
 - MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
     true  = c2
     false = c3
 - Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = (c1 + ((c2 + c3) + c4))
+    = (((c1 + c2) + c3) + c4)
 Highest counter ID seen: c4
 
 Function name: non_control_flow::assign_3_bis
-Raw bytes (85): 0x[01, 01, 07, 07, 11, 09, 0d, 01, 05, 05, 09, 16, 1a, 05, 09, 01, 05, 0a, 01, 1b, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 1a, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 16, 03, 00, 02, 00, 12, 00, 13, 13, 00, 17, 00, 18, 30, 0d, 11, 02, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
+Raw bytes (81): 0x[01, 01, 05, 07, 11, 09, 0d, 01, 05, 05, 09, 01, 09, 0a, 01, 1b, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 0a, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0e, 03, 00, 02, 00, 12, 00, 13, 12, 00, 17, 00, 18, 30, 0d, 11, 02, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 7
+Number of expressions: 5
 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(4)
 - expression 1 operands: lhs = Counter(2), rhs = Counter(3)
 - expression 2 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 3 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Expression(6, Sub)
-- expression 5 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 10
 - Code(Counter(0)) at (prev + 27, 1) to (start + 0, 44)
 - Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
     = ((c2 + c3) + c4)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
 - MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24)
-- MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
+- MCDCBranch { true: Counter(1), false: Expression(2, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
-- MCDCBranch { true: Counter(2), false: Expression(5, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19)
+- MCDCBranch { true: Counter(2), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19)
     true  = c2
     false = (c1 - c2)
-- Code(Expression(4, Add)) at (prev + 0, 23) to (start + 0, 24)
-    = ((c1 - c2) + (c0 - c1))
+- Code(Expression(4, Sub)) at (prev + 0, 23) to (start + 0, 24)
+    = (c0 - c2)
 - MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
     true  = c3
     false = c4
@@ -70,18 +68,18 @@ Number of file 0 mappings: 10
 Highest counter ID seen: c4
 
 Function name: non_control_flow::assign_and
-Raw bytes (64): 0x[01, 01, 04, 07, 0e, 09, 0d, 01, 05, 01, 05, 08, 01, 0c, 01, 00, 21, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 03, 01, 05, 01, 02]
+Raw bytes (64): 0x[01, 01, 04, 07, 05, 0b, 0d, 01, 09, 01, 05, 08, 01, 0c, 01, 00, 21, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 02, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 4
-- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(3, Sub)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(2)
 - expression 3 operands: lhs = Counter(0), rhs = Counter(1)
 Number of file 0 mappings: 8
 - Code(Counter(0)) at (prev + 12, 1) to (start + 0, 33)
-- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10)
+    = (((c0 + c2) + c3) - c1)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19)
 - MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
@@ -91,8 +89,8 @@ Number of file 0 mappings: 8
 - MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
     true  = c2
     false = c3
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: non_control_flow::assign_or
@@ -132,13 +130,14 @@ Number of file 0 mappings: 1
 Highest counter ID seen: c0
 
 Function name: non_control_flow::func_call
-Raw bytes (52): 0x[01, 01, 03, 01, 05, 0b, 02, 09, 0d, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 0d, 02, 00, 00, 00, 0e, 00, 0f, 07, 01, 01, 00, 02]
+Raw bytes (54): 0x[01, 01, 04, 01, 05, 0b, 05, 0f, 0d, 01, 09, 06, 01, 29, 01, 01, 0a, 28, 03, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 0d, 02, 00, 00, 00, 0e, 00, 0f, 06, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 3
+Number of expressions: 4
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(1)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 6
 - Code(Counter(0)) at (prev + 41, 1) to (start + 1, 10)
 - MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 1, 9) to (start + 0, 15)
@@ -149,63 +148,63 @@ Number of file 0 mappings: 6
 - MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15)
     true  = c2
     false = c3
-- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = ((c2 + c3) + (c0 - c1))
+- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2)
+    = (((c0 + c2) + c3) - c1)
 Highest counter ID seen: c3
 
 Function name: non_control_flow::right_comb_tree
-Raw bytes (139): 0x[01, 01, 13, 07, 1a, 0b, 19, 0f, 15, 13, 11, 09, 0d, 01, 05, 01, 05, 05, 19, 05, 19, 4a, 15, 05, 19, 4a, 15, 05, 19, 46, 11, 4a, 15, 05, 19, 46, 11, 4a, 15, 05, 19, 0e, 01, 20, 01, 00, 41, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 1a, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 4a, 19, 02, 03, 00, 00, 13, 00, 14, 4a, 00, 19, 00, 1a, 30, 46, 15, 03, 04, 00, 00, 19, 00, 1a, 46, 00, 1f, 00, 20, 30, 42, 11, 04, 05, 00, 00, 1f, 00, 20, 42, 00, 24, 00, 27, 30, 09, 0d, 05, 00, 00, 00, 24, 00, 27, 03, 01, 05, 01, 02]
+Raw bytes (139): 0x[01, 01, 13, 07, 05, 0b, 19, 0f, 15, 13, 11, 17, 0d, 01, 09, 01, 05, 05, 09, 05, 09, 05, 4b, 09, 0d, 05, 4b, 09, 0d, 05, 47, 4b, 11, 09, 0d, 05, 47, 4b, 11, 09, 0d, 0e, 01, 20, 01, 00, 41, 02, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 1a, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 22, 09, 02, 03, 00, 00, 13, 00, 14, 22, 00, 19, 00, 1a, 30, 2e, 0d, 03, 04, 00, 00, 19, 00, 1a, 2e, 00, 1f, 00, 20, 30, 42, 11, 04, 05, 00, 00, 1f, 00, 20, 42, 00, 24, 00, 27, 30, 15, 19, 05, 00, 00, 00, 24, 00, 27, 02, 01, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 19
-- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(6, Sub)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1)
 - expression 1 operands: lhs = Expression(2, Add), rhs = Counter(6)
 - expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5)
 - expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4)
-- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 5 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 - expression 6 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 7 operands: lhs = Counter(1), rhs = Counter(6)
-- expression 8 operands: lhs = Counter(1), rhs = Counter(6)
-- expression 9 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 10 operands: lhs = Counter(1), rhs = Counter(6)
-- expression 11 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 12 operands: lhs = Counter(1), rhs = Counter(6)
-- expression 13 operands: lhs = Expression(17, Sub), rhs = Counter(4)
-- expression 14 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 15 operands: lhs = Counter(1), rhs = Counter(6)
-- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(4)
-- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 18 operands: lhs = Counter(1), rhs = Counter(6)
+- expression 7 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 9 operands: lhs = Counter(1), rhs = Expression(18, Add)
+- expression 10 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 11 operands: lhs = Counter(1), rhs = Expression(18, Add)
+- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 13 operands: lhs = Counter(1), rhs = Expression(17, Add)
+- expression 14 operands: lhs = Expression(18, Add), rhs = Counter(4)
+- expression 15 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 16 operands: lhs = Counter(1), rhs = Expression(17, Add)
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(4)
+- expression 18 operands: lhs = Counter(2), rhs = Counter(3)
 Number of file 0 mappings: 14
 - Code(Counter(0)) at (prev + 32, 1) to (start + 0, 65)
-- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
-    = (((((c2 + c3) + c4) + c5) + c6) + (c0 - c1))
+- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 10)
+    = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1)
 - Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
 - MCDCDecision { bitmap_idx: 6, conditions_num: 5 } at (prev + 0, 13) to (start + 0, 42)
 - MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
     true  = c1
     false = (c0 - c1)
 - Code(Counter(1)) at (prev + 0, 19) to (start + 0, 20)
-- MCDCBranch { true: Expression(18, Sub), false: Counter(6), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20)
-    true  = (c1 - c6)
-    false = c6
-- Code(Expression(18, Sub)) at (prev + 0, 25) to (start + 0, 26)
-    = (c1 - c6)
-- MCDCBranch { true: Expression(17, Sub), false: Counter(5), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26)
-    true  = ((c1 - c6) - c5)
-    false = c5
-- Code(Expression(17, Sub)) at (prev + 0, 31) to (start + 0, 32)
-    = ((c1 - c6) - c5)
+- MCDCBranch { true: Expression(8, Sub), false: Counter(2), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20)
+    true  = (c1 - c2)
+    false = c2
+- Code(Expression(8, Sub)) at (prev + 0, 25) to (start + 0, 26)
+    = (c1 - c2)
+- MCDCBranch { true: Expression(11, Sub), false: Counter(3), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26)
+    true  = (c1 - (c2 + c3))
+    false = c3
+- Code(Expression(11, Sub)) at (prev + 0, 31) to (start + 0, 32)
+    = (c1 - (c2 + c3))
 - MCDCBranch { true: Expression(16, Sub), false: Counter(4), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32)
-    true  = (((c1 - c6) - c5) - c4)
+    true  = (c1 - ((c2 + c3) + c4))
     false = c4
 - Code(Expression(16, Sub)) at (prev + 0, 36) to (start + 0, 39)
-    = (((c1 - c6) - c5) - c4)
-- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39)
-    true  = c2
-    false = c3
-- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
-    = (((((c2 + c3) + c4) + c5) + c6) + (c0 - c1))
+    = (c1 - ((c2 + c3) + c4))
+- MCDCBranch { true: Counter(5), false: Counter(6), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39)
+    true  = c5
+    false = c6
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 1, 2)
+    = ((((((c0 + c2) + c3) + c4) + c5) + c6) - c1)
 Highest counter ID seen: c6
 
diff --git a/tests/coverage/nested_loops.cov-map b/tests/coverage/nested_loops.cov-map
index 21871ef3206..6ba5887d243 100644
--- a/tests/coverage/nested_loops.cov-map
+++ b/tests/coverage/nested_loops.cov-map
@@ -1,52 +1,46 @@
 Function name: nested_loops::main
-Raw bytes (115): 0x[01, 01, 17, 01, 57, 05, 09, 03, 0d, 4e, 53, 03, 0d, 15, 19, 4b, 09, 4e, 53, 03, 0d, 15, 19, 46, 05, 4b, 09, 4e, 53, 03, 0d, 15, 19, 42, 19, 46, 05, 4b, 09, 4e, 53, 03, 0d, 15, 19, 05, 09, 11, 0d, 0d, 01, 01, 01, 02, 1b, 03, 04, 13, 00, 20, 4e, 01, 0d, 01, 18, 4b, 02, 12, 00, 17, 46, 01, 10, 00, 16, 05, 01, 11, 00, 16, 42, 01, 0e, 03, 16, 3e, 04, 11, 01, 1b, 11, 02, 15, 00, 21, 15, 01, 18, 02, 12, 19, 03, 0d, 00, 0e, 57, 02, 09, 00, 17, 5b, 02, 01, 00, 02]
+Raw bytes (103): 0x[01, 01, 11, 27, 09, 01, 05, 03, 0d, 13, 0d, 17, 15, 03, 11, 1f, 0d, 23, 15, 27, 11, 01, 05, 2f, 0d, 3b, 15, 01, 11, 3b, 0d, 01, 11, 05, 09, 0d, 19, 0d, 01, 01, 01, 02, 1b, 03, 04, 13, 00, 20, 0a, 01, 0d, 01, 18, 0e, 02, 12, 00, 17, 1a, 01, 10, 00, 16, 05, 01, 11, 00, 16, 2a, 01, 0e, 03, 16, 36, 04, 11, 01, 1b, 19, 02, 15, 00, 21, 11, 01, 18, 02, 12, 15, 03, 0d, 00, 0e, 3f, 02, 09, 00, 17, 43, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 23
-- expression 0 operands: lhs = Counter(0), rhs = Expression(21, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+Number of expressions: 17
+- expression 0 operands: lhs = Expression(9, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
-- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 5 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 6 operands: lhs = Expression(18, Add), rhs = Counter(2)
-- expression 7 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
-- expression 8 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 9 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 10 operands: lhs = Expression(17, Sub), rhs = Counter(1)
-- expression 11 operands: lhs = Expression(18, Add), rhs = Counter(2)
-- expression 12 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
-- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 14 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(6)
-- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(1)
-- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(2)
-- expression 18 operands: lhs = Expression(19, Sub), rhs = Expression(20, Add)
-- expression 19 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 20 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 21 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 22 operands: lhs = Counter(4), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(5)
+- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(3)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(5)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 9 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(3)
+- expression 11 operands: lhs = Expression(14, Add), rhs = Counter(5)
+- expression 12 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(3)
+- expression 14 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 15 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 16 operands: lhs = Counter(3), rhs = Counter(6)
 Number of file 0 mappings: 13
 - Code(Counter(0)) at (prev + 1, 1) to (start + 2, 27)
 - Code(Expression(0, Add)) at (prev + 4, 19) to (start + 0, 32)
-    = (c0 + (c1 + c2))
-- Code(Expression(19, Sub)) at (prev + 1, 13) to (start + 1, 24)
-    = ((c0 + (c1 + c2)) - c3)
-- Code(Expression(18, Add)) at (prev + 2, 18) to (start + 0, 23)
-    = (((c0 + (c1 + c2)) - c3) + (c5 + c6))
-- Code(Expression(17, Sub)) at (prev + 1, 16) to (start + 0, 22)
-    = ((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2)
+    = ((c0 + c1) + c2)
+- Code(Expression(2, Sub)) at (prev + 1, 13) to (start + 1, 24)
+    = (((c0 + c1) + c2) - c3)
+- Code(Expression(3, Sub)) at (prev + 2, 18) to (start + 0, 23)
+    = (((((c0 + c1) + c2) + c4) + c5) - c3)
+- Code(Expression(6, Sub)) at (prev + 1, 16) to (start + 0, 22)
+    = ((((c0 + c1) + c4) + c5) - c3)
 - Code(Counter(1)) at (prev + 1, 17) to (start + 0, 22)
-- Code(Expression(16, Sub)) at (prev + 1, 14) to (start + 3, 22)
-    = (((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2) - c1)
-- Code(Expression(15, Sub)) at (prev + 4, 17) to (start + 1, 27)
-    = ((((((c0 + (c1 + c2)) - c3) + (c5 + c6)) - c2) - c1) - c6)
-- Code(Counter(4)) at (prev + 2, 21) to (start + 0, 33)
-- Code(Counter(5)) at (prev + 1, 24) to (start + 2, 18)
-- Code(Counter(6)) at (prev + 3, 13) to (start + 0, 14)
-- Code(Expression(21, Add)) at (prev + 2, 9) to (start + 0, 23)
+- Code(Expression(10, Sub)) at (prev + 1, 14) to (start + 3, 22)
+    = (((c0 + c4) + c5) - c3)
+- Code(Expression(13, Sub)) at (prev + 4, 17) to (start + 1, 27)
+    = ((c0 + c4) - c3)
+- Code(Counter(6)) at (prev + 2, 21) to (start + 0, 33)
+- Code(Counter(4)) at (prev + 1, 24) to (start + 2, 18)
+- Code(Counter(5)) at (prev + 3, 13) to (start + 0, 14)
+- Code(Expression(15, Add)) at (prev + 2, 9) to (start + 0, 23)
     = (c1 + c2)
-- Code(Expression(22, Add)) at (prev + 2, 1) to (start + 0, 2)
-    = (c4 + c3)
+- Code(Expression(16, Add)) at (prev + 2, 1) to (start + 0, 2)
+    = (c3 + c6)
 Highest counter ID seen: c6
 
diff --git a/tests/coverage/overflow.cov-map b/tests/coverage/overflow.cov-map
index f6bfb465bf9..01abcc15003 100644
--- a/tests/coverage/overflow.cov-map
+++ b/tests/coverage/overflow.cov-map
@@ -1,29 +1,30 @@
 Function name: overflow::main
-Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 10, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 03, 0a, 12, 03, 13, 00, 20, 09, 00, 21, 03, 0a, 0d, 03, 09, 00, 0a, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Raw bytes (67): 0x[01, 01, 09, 07, 0d, 0b, 09, 01, 05, 03, 11, 17, 11, 1b, 0d, 01, 09, 23, 0d, 05, 09, 09, 01, 10, 01, 01, 1b, 03, 02, 0b, 00, 18, 0e, 01, 0c, 00, 1a, 05, 00, 1b, 03, 0a, 12, 03, 13, 00, 20, 09, 00, 21, 03, 0a, 0d, 03, 09, 00, 0a, 1f, 01, 09, 00, 17, 11, 02, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 8
-- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+Number of expressions: 9
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
-- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 16, 1) to (start + 1, 27)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
-    = (c0 + (c1 + (c2 + c3)))
-- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
-    = ((c0 + (c1 + (c2 + c3))) - c4)
+    = (((c0 + c1) + c2) + c3)
+- Code(Expression(3, Sub)) at (prev + 1, 12) to (start + 0, 26)
+    = ((((c0 + c1) + c2) + c3) - c4)
 - Code(Counter(1)) at (prev + 0, 27) to (start + 3, 10)
 - Code(Expression(4, Sub)) at (prev + 3, 19) to (start + 0, 32)
-    = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+    = (((c0 + c2) + c3) - c4)
 - Code(Counter(2)) at (prev + 0, 33) to (start + 3, 10)
 - Code(Counter(3)) at (prev + 3, 9) to (start + 0, 10)
-- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (c1 + (c2 + c3))
+- Code(Expression(7, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = ((c1 + c2) + c3)
 - Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/panic_unwind.cov-map b/tests/coverage/panic_unwind.cov-map
index 58a796ff3a2..005c4babbea 100644
--- a/tests/coverage/panic_unwind.cov-map
+++ b/tests/coverage/panic_unwind.cov-map
@@ -1,29 +1,30 @@
 Function name: panic_unwind::main
-Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 09, 00, 0a, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Raw bytes (67): 0x[01, 01, 09, 07, 0d, 0b, 09, 01, 05, 03, 11, 17, 11, 1b, 0d, 01, 09, 23, 0d, 05, 09, 09, 01, 0d, 01, 01, 1b, 03, 02, 0b, 00, 18, 0e, 01, 0c, 00, 1a, 05, 00, 1b, 02, 0a, 12, 02, 13, 00, 20, 09, 00, 21, 02, 0a, 0d, 02, 09, 00, 0a, 1f, 01, 09, 00, 17, 11, 02, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 8
-- expression 0 operands: lhs = Counter(0), rhs = Expression(6, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+Number of expressions: 9
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 3 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(1)
-- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
-- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(3)
+- expression 6 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 13, 1) to (start + 1, 27)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
-    = (c0 + (c1 + (c2 + c3)))
-- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
-    = ((c0 + (c1 + (c2 + c3))) - c4)
+    = (((c0 + c1) + c2) + c3)
+- Code(Expression(3, Sub)) at (prev + 1, 12) to (start + 0, 26)
+    = ((((c0 + c1) + c2) + c3) - c4)
 - Code(Counter(1)) at (prev + 0, 27) to (start + 2, 10)
 - Code(Expression(4, Sub)) at (prev + 2, 19) to (start + 0, 32)
-    = (((c0 + (c1 + (c2 + c3))) - c4) - c1)
+    = (((c0 + c2) + c3) - c4)
 - Code(Counter(2)) at (prev + 0, 33) to (start + 2, 10)
 - Code(Counter(3)) at (prev + 2, 9) to (start + 0, 10)
-- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 0, 23)
-    = (c1 + (c2 + c3))
+- Code(Expression(7, Add)) at (prev + 1, 9) to (start + 0, 23)
+    = ((c1 + c2) + c3)
 - Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/simple_match.cov-map b/tests/coverage/simple_match.cov-map
index d8bf9eae4bc..8f973742959 100644
--- a/tests/coverage/simple_match.cov-map
+++ b/tests/coverage/simple_match.cov-map
@@ -1,29 +1,29 @@
 Function name: simple_match::main
-Raw bytes (72): 0x[01, 01, 09, 01, 05, 01, 23, 09, 0d, 1f, 11, 01, 23, 09, 0d, 1f, 11, 01, 23, 09, 0d, 0a, 01, 04, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 05, 00, 06, 1f, 05, 09, 00, 0d, 1a, 05, 0d, 00, 16, 09, 02, 0d, 00, 0e, 1a, 02, 11, 02, 12, 09, 04, 0d, 07, 0e, 0d, 0a, 0d, 00, 0f, 11, 03, 01, 00, 02]
+Raw bytes (72): 0x[01, 01, 09, 01, 05, 23, 0d, 01, 09, 1f, 11, 23, 0d, 01, 09, 1f, 11, 23, 0d, 01, 09, 0a, 01, 04, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 05, 00, 06, 1f, 05, 09, 00, 0d, 1a, 05, 0d, 00, 16, 09, 02, 0d, 00, 0e, 1a, 02, 11, 02, 12, 09, 04, 0d, 07, 0e, 0d, 0a, 0d, 00, 0f, 11, 03, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 9
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(0), rhs = Expression(8, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 1 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(2)
 - expression 3 operands: lhs = Expression(7, Add), rhs = Counter(4)
-- expression 4 operands: lhs = Counter(0), rhs = Expression(8, Add)
-- expression 5 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
 - expression 6 operands: lhs = Expression(7, Add), rhs = Counter(4)
-- expression 7 operands: lhs = Counter(0), rhs = Expression(8, Add)
-- expression 8 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(0), rhs = Counter(2)
 Number of file 0 mappings: 10
 - Code(Counter(0)) at (prev + 4, 1) to (start + 7, 15)
 - Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
 - Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
     = (c0 - c1)
 - Code(Expression(7, Add)) at (prev + 5, 9) to (start + 0, 13)
-    = (c0 + (c2 + c3))
+    = ((c0 + c2) + c3)
 - Code(Expression(6, Sub)) at (prev + 5, 13) to (start + 0, 22)
-    = ((c0 + (c2 + c3)) - c4)
+    = (((c0 + c2) + c3) - c4)
 - Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14)
 - Code(Expression(6, Sub)) at (prev + 2, 17) to (start + 2, 18)
-    = ((c0 + (c2 + c3)) - c4)
+    = (((c0 + c2) + c3) - c4)
 - Code(Counter(2)) at (prev + 4, 13) to (start + 7, 14)
 - Code(Counter(3)) at (prev + 10, 13) to (start + 0, 15)
 - Code(Counter(4)) at (prev + 3, 1) to (start + 0, 2)
diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map
index 246a1ba738b..7fbd2cc642e 100644
--- a/tests/coverage/try_error_result.cov-map
+++ b/tests/coverage/try_error_result.cov-map
@@ -55,162 +55,162 @@ Number of file 0 mappings: 4
 Highest counter ID seen: c1
 
 Function name: try_error_result::test1
-Raw bytes (75): 0x[01, 01, 08, 01, 07, 00, 09, 03, 0d, 12, 1d, 03, 0d, 1b, 0d, 1f, 00, 11, 00, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 12, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 17, 01, 01, 00, 02]
+Raw bytes (75): 0x[01, 01, 08, 07, 09, 01, 00, 03, 0d, 03, 13, 0d, 11, 1b, 00, 1f, 00, 0d, 15, 0b, 01, 0d, 01, 02, 17, 03, 07, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 29, 15, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 17, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 8
-- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Zero, rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Zero
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Expression(4, Sub), rhs = Counter(7)
-- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Expression(0, Add), rhs = Expression(4, Add)
+- expression 4 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Zero
 - expression 6 operands: lhs = Expression(7, Add), rhs = Zero
-- expression 7 operands: lhs = Counter(4), rhs = Zero
+- expression 7 operands: lhs = Counter(3), rhs = Counter(5)
 Number of file 0 mappings: 11
 - Code(Counter(0)) at (prev + 13, 1) to (start + 2, 23)
 - Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14)
-    = (c0 + (Zero + c2))
-- Code(Expression(4, Sub)) at (prev + 2, 9) to (start + 4, 26)
-    = ((c0 + (Zero + c2)) - c3)
-- Code(Counter(7)) at (prev + 6, 13) to (start + 0, 41)
-- Code(Counter(4)) at (prev + 0, 41) to (start + 0, 42)
+    = ((c0 + Zero) + c2)
+- Code(Expression(2, Sub)) at (prev + 2, 9) to (start + 4, 26)
+    = (((c0 + Zero) + c2) - c3)
+- Code(Counter(4)) at (prev + 6, 13) to (start + 0, 41)
+- Code(Counter(5)) at (prev + 0, 41) to (start + 0, 42)
 - Code(Zero) at (prev + 1, 13) to (start + 0, 42)
 - Code(Zero) at (prev + 0, 42) to (start + 0, 43)
 - Code(Expression(3, Sub)) at (prev + 4, 13) to (start + 0, 42)
-    = (((c0 + (Zero + c2)) - c3) - c7)
+    = (((c0 + Zero) + c2) - (c3 + c4))
 - Code(Zero) at (prev + 0, 42) to (start + 0, 43)
 - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
 - Code(Expression(5, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = (((c4 + Zero) + Zero) + c3)
-Highest counter ID seen: c7
+    = (((c3 + c5) + Zero) + Zero)
+Highest counter ID seen: c5
 
 Function name: try_error_result::test2
-Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, c7, 01, db, 01, cb, 01, cf, 01, 11, 15, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3d, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
+Raw bytes (355): 0x[01, 01, 3b, 07, 09, 01, 05, 03, 0d, 11, 15, 11, 4b, 15, 19, 11, 43, 47, 21, 4b, 1d, 15, 19, 11, 4b, 15, 19, 11, 47, 4b, 1d, 15, 19, 11, 43, 47, 21, 4b, 1d, 15, 19, 45, 5f, 25, 29, 45, 25, 45, 5f, 25, 29, 03, 8b, 01, 8f, 01, 31, 93, 01, 2d, 0d, 11, 03, 93, 01, 0d, 11, 03, 8f, 01, 93, 01, 2d, 0d, 11, 03, 8b, 01, 8f, 01, 31, 93, 01, 2d, 0d, 11, 49, a7, 01, 35, 39, 49, 35, 49, a7, 01, 35, 39, 4d, bb, 01, 3d, 41, 4d, 3d, 4d, bb, 01, 3d, 41, c3, 01, 41, c7, 01, 3d, cb, 01, 39, cf, 01, 35, d3, 01, 31, d7, 01, 2d, db, 01, 29, df, 01, 25, e3, 01, 21, e7, 01, 1d, eb, 01, 19, 0d, 15, 28, 01, 3d, 01, 03, 17, 03, 08, 09, 00, 0e, 0a, 02, 09, 04, 1a, 11, 06, 0d, 00, 2f, 15, 00, 2f, 00, 30, 0e, 00, 31, 03, 35, 19, 04, 11, 00, 12, 2a, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 2a, 00, 17, 00, 41, 1d, 00, 41, 00, 42, 32, 00, 43, 00, 5f, 21, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 45, 00, 17, 00, 41, 25, 00, 41, 00, 42, 56, 00, 43, 00, 60, 29, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 72, 00, 17, 00, 42, 2d, 00, 42, 00, 43, 7a, 00, 44, 00, 61, 31, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 49, 00, 17, 01, 36, 35, 01, 36, 00, 37, 9e, 01, 01, 12, 00, 2f, 39, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 3d, 02, 11, 00, 12, b2, 01, 01, 12, 00, 2f, 41, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 59
-- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 5 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 6 operands: lhs = Expression(16, Sub), rhs = Counter(7)
-- expression 7 operands: lhs = Expression(17, Sub), rhs = Counter(6)
-- expression 8 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 9 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 10 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 11 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 12 operands: lhs = Expression(17, Sub), rhs = Counter(6)
-- expression 13 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 14 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(7)
-- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(6)
-- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(5)
-- expression 18 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 19 operands: lhs = Expression(23, Sub), rhs = Counter(9)
-- expression 20 operands: lhs = Counter(18), rhs = Counter(8)
-- expression 21 operands: lhs = Counter(18), rhs = Counter(8)
-- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(9)
-- expression 23 operands: lhs = Counter(18), rhs = Counter(8)
-- expression 24 operands: lhs = Expression(34, Sub), rhs = Counter(11)
-- expression 25 operands: lhs = Expression(35, Sub), rhs = Counter(10)
-- expression 26 operands: lhs = Expression(36, Sub), rhs = Counter(16)
-- expression 27 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 28 operands: lhs = Expression(36, Sub), rhs = Counter(16)
-- expression 29 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 30 operands: lhs = Expression(35, Sub), rhs = Counter(10)
-- expression 31 operands: lhs = Expression(36, Sub), rhs = Counter(16)
-- expression 32 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 33 operands: lhs = Expression(34, Sub), rhs = Counter(11)
-- expression 34 operands: lhs = Expression(35, Sub), rhs = Counter(10)
-- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(16)
-- expression 36 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 37 operands: lhs = Expression(41, Sub), rhs = Counter(13)
-- expression 38 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 39 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(13)
-- expression 41 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 42 operands: lhs = Expression(46, Sub), rhs = Counter(15)
-- expression 43 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 44 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(15)
-- expression 46 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(54, Add)
-- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(51, Add)
-- expression 50 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 51 operands: lhs = Expression(52, Add), rhs = Expression(53, Add)
-- expression 52 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 53 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 54 operands: lhs = Expression(55, Add), rhs = Expression(56, Add)
-- expression 55 operands: lhs = Counter(10), rhs = Counter(11)
-- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(58, Add)
-- expression 57 operands: lhs = Counter(12), rhs = Counter(13)
-- expression 58 operands: lhs = Counter(14), rhs = Counter(15)
+- expression 3 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 4 operands: lhs = Counter(4), rhs = Expression(18, Add)
+- expression 5 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 6 operands: lhs = Counter(4), rhs = Expression(16, Add)
+- expression 7 operands: lhs = Expression(17, Add), rhs = Counter(8)
+- expression 8 operands: lhs = Expression(18, Add), rhs = Counter(7)
+- expression 9 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 10 operands: lhs = Counter(4), rhs = Expression(18, Add)
+- expression 11 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 12 operands: lhs = Counter(4), rhs = Expression(17, Add)
+- expression 13 operands: lhs = Expression(18, Add), rhs = Counter(7)
+- expression 14 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 15 operands: lhs = Counter(4), rhs = Expression(16, Add)
+- expression 16 operands: lhs = Expression(17, Add), rhs = Counter(8)
+- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(7)
+- expression 18 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 19 operands: lhs = Counter(17), rhs = Expression(23, Add)
+- expression 20 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 21 operands: lhs = Counter(17), rhs = Counter(9)
+- expression 22 operands: lhs = Counter(17), rhs = Expression(23, Add)
+- expression 23 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 24 operands: lhs = Expression(0, Add), rhs = Expression(34, Add)
+- expression 25 operands: lhs = Expression(35, Add), rhs = Counter(12)
+- expression 26 operands: lhs = Expression(36, Add), rhs = Counter(11)
+- expression 27 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 28 operands: lhs = Expression(0, Add), rhs = Expression(36, Add)
+- expression 29 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 30 operands: lhs = Expression(0, Add), rhs = Expression(35, Add)
+- expression 31 operands: lhs = Expression(36, Add), rhs = Counter(11)
+- expression 32 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 33 operands: lhs = Expression(0, Add), rhs = Expression(34, Add)
+- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(12)
+- expression 35 operands: lhs = Expression(36, Add), rhs = Counter(11)
+- expression 36 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 37 operands: lhs = Counter(18), rhs = Expression(41, Add)
+- expression 38 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 39 operands: lhs = Counter(18), rhs = Counter(13)
+- expression 40 operands: lhs = Counter(18), rhs = Expression(41, Add)
+- expression 41 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 42 operands: lhs = Counter(19), rhs = Expression(46, Add)
+- expression 43 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 44 operands: lhs = Counter(19), rhs = Counter(15)
+- expression 45 operands: lhs = Counter(19), rhs = Expression(46, Add)
+- expression 46 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(16)
+- expression 48 operands: lhs = Expression(49, Add), rhs = Counter(15)
+- expression 49 operands: lhs = Expression(50, Add), rhs = Counter(14)
+- expression 50 operands: lhs = Expression(51, Add), rhs = Counter(13)
+- expression 51 operands: lhs = Expression(52, Add), rhs = Counter(12)
+- expression 52 operands: lhs = Expression(53, Add), rhs = Counter(11)
+- expression 53 operands: lhs = Expression(54, Add), rhs = Counter(10)
+- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(9)
+- expression 55 operands: lhs = Expression(56, Add), rhs = Counter(8)
+- expression 56 operands: lhs = Expression(57, Add), rhs = Counter(7)
+- expression 57 operands: lhs = Expression(58, Add), rhs = Counter(6)
+- expression 58 operands: lhs = Counter(3), rhs = Counter(5)
 Number of file 0 mappings: 40
 - Code(Counter(0)) at (prev + 61, 1) to (start + 3, 23)
 - Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14)
-    = (c0 + (c1 + c2))
-- Code(Expression(36, Sub)) at (prev + 2, 9) to (start + 4, 26)
-    = ((c0 + (c1 + c2)) - c3)
-- Code(Counter(16)) at (prev + 6, 13) to (start + 0, 47)
-- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48)
-- Code(Expression(18, Sub)) at (prev + 0, 49) to (start + 3, 53)
-    = (c16 - c4)
-- Code(Counter(5)) at (prev + 4, 17) to (start + 0, 18)
-- Code(Expression(17, Sub)) at (prev + 2, 17) to (start + 4, 18)
-    = ((c16 - c4) - c5)
+    = ((c0 + c1) + c2)
+- Code(Expression(2, Sub)) at (prev + 2, 9) to (start + 4, 26)
+    = (((c0 + c1) + c2) - c3)
+- Code(Counter(4)) at (prev + 6, 13) to (start + 0, 47)
+- Code(Counter(5)) at (prev + 0, 47) to (start + 0, 48)
+- Code(Expression(3, Sub)) at (prev + 0, 49) to (start + 3, 53)
+    = (c4 - c5)
+- Code(Counter(6)) at (prev + 4, 17) to (start + 0, 18)
+- Code(Expression(10, Sub)) at (prev + 2, 17) to (start + 4, 18)
+    = (c4 - (c5 + c6))
 - Code(Expression(15, Sub)) at (prev + 5, 17) to (start + 0, 20)
-    = ((((c16 - c4) - c5) - c6) - c7)
-- Code(Expression(17, Sub)) at (prev + 0, 23) to (start + 0, 65)
-    = ((c16 - c4) - c5)
-- Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66)
-- Code(Expression(16, Sub)) at (prev + 0, 67) to (start + 0, 95)
-    = (((c16 - c4) - c5) - c6)
-- Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96)
+    = (c4 - (((c5 + c6) + c7) + c8))
+- Code(Expression(10, Sub)) at (prev + 0, 23) to (start + 0, 65)
+    = (c4 - (c5 + c6))
+- Code(Counter(7)) at (prev + 0, 65) to (start + 0, 66)
+- Code(Expression(12, Sub)) at (prev + 0, 67) to (start + 0, 95)
+    = (c4 - ((c5 + c6) + c7))
+- Code(Counter(8)) at (prev + 0, 95) to (start + 0, 96)
 - Code(Expression(15, Sub)) at (prev + 1, 13) to (start + 0, 32)
-    = ((((c16 - c4) - c5) - c6) - c7)
+    = (c4 - (((c5 + c6) + c7) + c8))
 - Code(Expression(22, Sub)) at (prev + 1, 17) to (start + 0, 20)
-    = ((c18 - c8) - c9)
-- Code(Counter(18)) at (prev + 0, 23) to (start + 0, 65)
-- Code(Counter(8)) at (prev + 0, 65) to (start + 0, 66)
-- Code(Expression(23, Sub)) at (prev + 0, 67) to (start + 0, 96)
-    = (c18 - c8)
-- Code(Counter(9)) at (prev + 0, 96) to (start + 0, 97)
+    = (c17 - (c9 + c10))
+- Code(Counter(17)) at (prev + 0, 23) to (start + 0, 65)
+- Code(Counter(9)) at (prev + 0, 65) to (start + 0, 66)
+- Code(Expression(21, Sub)) at (prev + 0, 67) to (start + 0, 96)
+    = (c17 - c9)
+- Code(Counter(10)) at (prev + 0, 96) to (start + 0, 97)
 - Code(Expression(22, Sub)) at (prev + 1, 13) to (start + 0, 32)
-    = ((c18 - c8) - c9)
+    = (c17 - (c9 + c10))
 - Code(Expression(33, Sub)) at (prev + 4, 17) to (start + 0, 20)
-    = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
-- Code(Expression(35, Sub)) at (prev + 0, 23) to (start + 0, 66)
-    = (((c0 + (c1 + c2)) - c3) - c16)
-- Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67)
-- Code(Expression(34, Sub)) at (prev + 0, 68) to (start + 0, 97)
-    = ((((c0 + (c1 + c2)) - c3) - c16) - c10)
-- Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98)
+    = (((c0 + c1) + c2) - (((c3 + c4) + c11) + c12))
+- Code(Expression(28, Sub)) at (prev + 0, 23) to (start + 0, 66)
+    = (((c0 + c1) + c2) - (c3 + c4))
+- Code(Counter(11)) at (prev + 0, 66) to (start + 0, 67)
+- Code(Expression(30, Sub)) at (prev + 0, 68) to (start + 0, 97)
+    = (((c0 + c1) + c2) - ((c3 + c4) + c11))
+- Code(Counter(12)) at (prev + 0, 97) to (start + 0, 98)
 - Code(Expression(33, Sub)) at (prev + 1, 13) to (start + 0, 32)
-    = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
+    = (((c0 + c1) + c2) - (((c3 + c4) + c11) + c12))
 - Code(Expression(40, Sub)) at (prev + 1, 17) to (start + 0, 20)
-    = ((c17 - c12) - c13)
-- Code(Counter(17)) at (prev + 0, 23) to (start + 1, 54)
-- Code(Counter(12)) at (prev + 1, 54) to (start + 0, 55)
-- Code(Expression(41, Sub)) at (prev + 1, 18) to (start + 0, 47)
-    = (c17 - c12)
-- Code(Counter(13)) at (prev + 0, 47) to (start + 0, 48)
+    = (c18 - (c13 + c14))
+- Code(Counter(18)) at (prev + 0, 23) to (start + 1, 54)
+- Code(Counter(13)) at (prev + 1, 54) to (start + 0, 55)
+- Code(Expression(39, Sub)) at (prev + 1, 18) to (start + 0, 47)
+    = (c18 - c13)
+- Code(Counter(14)) at (prev + 0, 47) to (start + 0, 48)
 - Code(Expression(40, Sub)) at (prev + 1, 13) to (start + 0, 32)
-    = ((c17 - c12) - c13)
+    = (c18 - (c13 + c14))
 - Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20)
-    = ((c19 - c14) - c15)
+    = (c19 - (c15 + c16))
 - Code(Counter(19)) at (prev + 0, 23) to (start + 1, 54)
-- Code(Counter(14)) at (prev + 2, 17) to (start + 0, 18)
-- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47)
-    = (c19 - c14)
-- Code(Counter(15)) at (prev + 1, 17) to (start + 0, 18)
+- Code(Counter(15)) at (prev + 2, 17) to (start + 0, 18)
+- Code(Expression(44, Sub)) at (prev + 1, 18) to (start + 0, 47)
+    = (c19 - c15)
+- Code(Counter(16)) at (prev + 1, 17) to (start + 0, 18)
 - Code(Expression(45, Sub)) at (prev + 2, 13) to (start + 0, 32)
-    = ((c19 - c14) - c15)
+    = (c19 - (c15 + c16))
 - Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
 - Code(Expression(47, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = ((((c4 + c5) + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15)))) + c3)
+    = ((((((((((((c3 + c5) + c6) + c7) + c8) + c9) + c10) + c11) + c12) + c13) + c14) + c15) + c16)
 Highest counter ID seen: c19
 
diff --git a/tests/coverage/unicode.cov-map b/tests/coverage/unicode.cov-map
index 769930110d6..630ab4ce47e 100644
--- a/tests/coverage/unicode.cov-map
+++ b/tests/coverage/unicode.cov-map
@@ -1,14 +1,14 @@
 Function name: unicode::main
-Raw bytes (61): 0x[01, 01, 06, 01, 05, 16, 0d, 01, 09, 11, 13, 16, 0d, 01, 09, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 11, 00, 47, 02, 06, 13, 02, 05, 00, 06, 0f, 02, 05, 01, 02]
+Raw bytes (61): 0x[01, 01, 06, 01, 05, 0b, 09, 01, 11, 13, 09, 17, 11, 01, 0d, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0c, 03, 00, 10, 00, 1b, 05, 00, 1c, 00, 28, 01, 02, 08, 00, 25, 09, 00, 29, 00, 46, 0d, 00, 47, 02, 06, 06, 02, 05, 00, 06, 0e, 02, 05, 01, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 6
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(5, Sub), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(2)
-- expression 3 operands: lhs = Counter(4), rhs = Expression(4, Add)
-- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(3)
-- expression 5 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 1 operands: lhs = Expression(2, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(4)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Counter(0), rhs = Counter(3)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 14, 1) to (start + 0, 11)
 - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 12)
@@ -17,12 +17,12 @@ Number of file 0 mappings: 9
 - Code(Counter(1)) at (prev + 0, 28) to (start + 0, 40)
 - Code(Counter(0)) at (prev + 2, 8) to (start + 0, 37)
 - Code(Counter(2)) at (prev + 0, 41) to (start + 0, 70)
-- Code(Counter(4)) at (prev + 0, 71) to (start + 2, 6)
-- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
-    = ((c0 - c2) + c3)
-- Code(Expression(3, Add)) at (prev + 2, 5) to (start + 1, 2)
-    = (c4 + ((c0 - c2) + c3))
-Highest counter ID seen: c4
+- Code(Counter(3)) at (prev + 0, 71) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 2, 5) to (start + 0, 6)
+    = ((c0 + c4) - c2)
+- Code(Expression(3, Sub)) at (prev + 2, 5) to (start + 1, 2)
+    = (((c0 + c3) + c4) - c2)
+Highest counter ID seen: c3
 
 Function name: unicode::ä»– (unused)
 Raw bytes (9): 0x[01, 01, 00, 01, 00, 1e, 19, 00, 25]
diff --git a/tests/coverage/unused.cov-map b/tests/coverage/unused.cov-map
index e865ac3ee62..4eae63f380c 100644
--- a/tests/coverage/unused.cov-map
+++ b/tests/coverage/unused.cov-map
@@ -1,18 +1,18 @@
 Function name: unused::foo::<f32>
-Raw bytes (42): 0x[01, 01, 04, 01, 0f, 05, 09, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
+Raw bytes (42): 0x[01, 01, 04, 07, 09, 01, 05, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 4
-- expression 0 operands: lhs = Counter(0), rhs = Expression(3, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
 - expression 3 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 6
 - Code(Counter(0)) at (prev + 3, 1) to (start + 1, 18)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 17)
-    = (c0 + (c1 + c2))
+    = ((c0 + c1) + c2)
 - Code(Expression(2, Sub)) at (prev + 1, 9) to (start + 0, 15)
-    = ((c0 + (c1 + c2)) - c3)
+    = (((c0 + c1) + c2) - c3)
 - Code(Counter(2)) at (prev + 0, 19) to (start + 0, 25)
 - Code(Expression(3, Add)) at (prev + 1, 9) to (start + 0, 15)
     = (c1 + c2)
@@ -20,20 +20,20 @@ Number of file 0 mappings: 6
 Highest counter ID seen: c3
 
 Function name: unused::foo::<u32>
-Raw bytes (42): 0x[01, 01, 04, 01, 0f, 05, 09, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
+Raw bytes (42): 0x[01, 01, 04, 07, 09, 01, 05, 03, 0d, 05, 09, 06, 01, 03, 01, 01, 12, 03, 02, 0b, 00, 11, 0a, 01, 09, 00, 0f, 09, 00, 13, 00, 19, 0f, 01, 09, 00, 0f, 0d, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 4
-- expression 0 operands: lhs = Counter(0), rhs = Expression(3, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
 - expression 3 operands: lhs = Counter(1), rhs = Counter(2)
 Number of file 0 mappings: 6
 - Code(Counter(0)) at (prev + 3, 1) to (start + 1, 18)
 - Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 17)
-    = (c0 + (c1 + c2))
+    = ((c0 + c1) + c2)
 - Code(Expression(2, Sub)) at (prev + 1, 9) to (start + 0, 15)
-    = ((c0 + (c1 + c2)) - c3)
+    = (((c0 + c1) + c2) - c3)
 - Code(Counter(2)) at (prev + 0, 19) to (start + 0, 25)
 - Code(Expression(3, Add)) at (prev + 1, 9) to (start + 0, 15)
     = (c1 + c2)
diff --git a/tests/coverage/while_early_ret.cov-map b/tests/coverage/while_early_ret.cov-map
index 6254dfbcf01..ade770597e2 100644
--- a/tests/coverage/while_early_ret.cov-map
+++ b/tests/coverage/while_early_ret.cov-map
@@ -1,27 +1,26 @@
 Function name: while_early_ret::main
-Raw bytes (61): 0x[01, 01, 06, 01, 05, 03, 09, 0e, 05, 03, 09, 17, 09, 0d, 11, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 0e, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 11, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 13, 01, 01, 00, 02]
+Raw bytes (59): 0x[01, 01, 05, 01, 05, 03, 09, 01, 09, 13, 11, 09, 0d, 09, 01, 05, 01, 01, 1b, 03, 03, 09, 02, 0a, 06, 05, 0d, 02, 0e, 0a, 06, 15, 02, 16, 0d, 04, 15, 00, 1b, 11, 04, 15, 00, 1b, 05, 03, 0a, 03, 0a, 09, 06, 05, 00, 0b, 0f, 01, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
-Number of expressions: 6
+Number of expressions: 5
 - expression 0 operands: lhs = Counter(0), rhs = Counter(1)
 - expression 1 operands: lhs = Expression(0, Add), rhs = Counter(2)
-- expression 2 operands: lhs = Expression(3, Sub), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Add), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 2 operands: lhs = Counter(0), rhs = Counter(2)
+- expression 3 operands: lhs = Expression(4, Add), rhs = Counter(4)
+- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
 Number of file 0 mappings: 9
 - Code(Counter(0)) at (prev + 5, 1) to (start + 1, 27)
 - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 2, 10)
     = (c0 + c1)
-- Code(Expression(3, Sub)) at (prev + 5, 13) to (start + 2, 14)
+- Code(Expression(1, Sub)) at (prev + 5, 13) to (start + 2, 14)
     = ((c0 + c1) - c2)
 - Code(Expression(2, Sub)) at (prev + 6, 21) to (start + 2, 22)
-    = (((c0 + c1) - c2) - c1)
+    = (c0 - c2)
 - Code(Counter(3)) at (prev + 4, 21) to (start + 0, 27)
 - Code(Counter(4)) at (prev + 4, 21) to (start + 0, 27)
 - Code(Counter(1)) at (prev + 3, 10) to (start + 3, 10)
 - Code(Counter(2)) at (prev + 6, 5) to (start + 0, 11)
-- Code(Expression(4, Add)) at (prev + 1, 1) to (start + 0, 2)
-    = ((c3 + c4) + c2)
+- Code(Expression(3, Add)) at (prev + 1, 1) to (start + 0, 2)
+    = ((c2 + c3) + c4)
 Highest counter ID seen: c4
 
diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map
index 578994a4530..e01ec8f9edb 100644
--- a/tests/coverage/yield.cov-map
+++ b/tests/coverage/yield.cov-map
@@ -1,17 +1,17 @@
 Function name: yield::main
-Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02]
+Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 0d, 23, 11, 15, 11, 15, 0d, 23, 11, 15, 0d, 23, 11, 15, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 06, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 23, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02]
 Number of files: 1
 - file 0 => global file 1
 Number of expressions: 11
 - expression 0 operands: lhs = Counter(1), rhs = Zero
 - expression 1 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 2 operands: lhs = Expression(8, Sub), rhs = Counter(5)
-- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 2 operands: lhs = Counter(3), rhs = Expression(8, Add)
+- expression 3 operands: lhs = Counter(4), rhs = Counter(5)
 - expression 4 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 5 operands: lhs = Expression(8, Sub), rhs = Counter(5)
-- expression 6 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(5)
-- expression 8 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 5 operands: lhs = Counter(3), rhs = Expression(8, Add)
+- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add)
+- expression 8 operands: lhs = Counter(4), rhs = Counter(5)
 - expression 9 operands: lhs = Counter(6), rhs = Counter(7)
 - expression 10 operands: lhs = Counter(9), rhs = Counter(10)
 Number of file 0 mappings: 16
@@ -21,16 +21,16 @@ Number of file 0 mappings: 16
 - Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 52)
     = (c1 + Zero)
 - Code(Counter(3)) at (prev + 2, 11) to (start + 0, 46)
-- Code(Expression(8, Sub)) at (prev + 1, 34) to (start + 0, 39)
+- Code(Expression(1, Sub)) at (prev + 1, 34) to (start + 0, 39)
     = (c3 - c4)
 - Code(Expression(7, Sub)) at (prev + 0, 44) to (start + 0, 46)
-    = ((c3 - c4) - c5)
-- Code(Expression(4, Add)) at (prev + 1, 14) to (start + 0, 52)
+    = (c3 - (c4 + c5))
+- Code(Expression(8, Add)) at (prev + 1, 14) to (start + 0, 52)
     = (c4 + c5)
 - Code(Expression(7, Sub)) at (prev + 3, 9) to (start + 0, 22)
-    = ((c3 - c4) - c5)
+    = (c3 - (c4 + c5))
 - Code(Expression(7, Sub)) at (prev + 8, 11) to (start + 0, 46)
-    = ((c3 - c4) - c5)
+    = (c3 - (c4 + c5))
 - Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41)
 - Code(Expression(9, Add)) at (prev + 1, 14) to (start + 0, 52)
     = (c6 + c7)
diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
index cbb11d50f79..8dd23e4d6a3 100644
--- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
@@ -30,15 +30,12 @@
 +     coverage ExpressionId(0) => Expression { lhs: Counter(1), op: Add, rhs: Counter(2) };
 +     coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Add, rhs: Counter(3) };
 +     coverage ExpressionId(2) => Expression { lhs: Counter(0), op: Subtract, rhs: Expression(1) };
-+     coverage ExpressionId(3) => Expression { lhs: Counter(3), op: Add, rhs: Counter(2) };
-+     coverage ExpressionId(4) => Expression { lhs: Expression(3), op: Add, rhs: Counter(1) };
-+     coverage ExpressionId(5) => Expression { lhs: Expression(4), op: Add, rhs: Expression(2) };
 +     coverage Code(Counter(0)) => 14:1 - 15:21;
-+     coverage Code(Counter(3)) => 16:17 - 16:33;
++     coverage Code(Counter(1)) => 16:17 - 16:33;
 +     coverage Code(Counter(2)) => 17:17 - 17:33;
-+     coverage Code(Counter(1)) => 18:17 - 18:33;
++     coverage Code(Counter(3)) => 18:17 - 18:33;
 +     coverage Code(Expression(2)) => 19:17 - 19:33;
-+     coverage Code(Expression(5)) => 21:1 - 21:2;
++     coverage Code(Counter(0)) => 21:1 - 21:2;
 + 
       bb0: {
 +         Coverage::CounterIncrement(0);
@@ -55,7 +52,7 @@
       }
   
       bb2: {
-+         Coverage::CounterIncrement(3);
++         Coverage::CounterIncrement(1);
           falseEdge -> [real: bb8, imaginary: bb3];
       }
   
@@ -65,7 +62,7 @@
       }
   
       bb4: {
-+         Coverage::CounterIncrement(1);
++         Coverage::CounterIncrement(3);
           falseEdge -> [real: bb6, imaginary: bb5];
       }
   
@@ -127,7 +124,6 @@
       }
   
       bb13: {
-+         Coverage::ExpressionUsed(5);
           StorageDead(_1);
           return;
       }
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
index 87fbcca9177..027c71dfaae 100644
--- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
@@ -31,7 +31,6 @@
               }
           }
           scope 9 (inlined NonNull::<[u8]>::as_ptr) {
-              let mut _17: *const [u8];
           }
       }
       scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
@@ -102,16 +101,9 @@
           StorageDead(_16);
           StorageDead(_12);
           StorageDead(_6);
--         StorageLive(_17);
-+         nop;
-          _17 = copy (_5.0: *const [u8]);
--         _4 = move _17 as *mut [u8] (PtrToPtr);
--         StorageDead(_17);
-+         _4 = copy _17 as *mut [u8] (PtrToPtr);
-+         nop;
+          _4 = copy _5 as *mut [u8] (Transmute);
           StorageDead(_5);
--         _3 = move _4 as *mut u8 (PtrToPtr);
-+         _3 = copy _17 as *mut u8 (PtrToPtr);
+          _3 = move _4 as *mut u8 (PtrToPtr);
           StorageDead(_4);
           StorageDead(_3);
 -         StorageDead(_1);
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
index 5fcece2280d..88bd4628c29 100644
--- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
@@ -20,7 +20,6 @@
           scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
           }
           scope 6 (inlined NonNull::<[u8]>::as_ptr) {
-              let mut _12: *const [u8];
           }
       }
       scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
@@ -45,16 +44,9 @@
   
       bb1: {
           StorageDead(_6);
--         StorageLive(_12);
-+         nop;
-          _12 = copy (_5.0: *const [u8]);
--         _4 = move _12 as *mut [u8] (PtrToPtr);
--         StorageDead(_12);
-+         _4 = copy _12 as *mut [u8] (PtrToPtr);
-+         nop;
+          _4 = copy _5 as *mut [u8] (Transmute);
           StorageDead(_5);
--         _3 = move _4 as *mut u8 (PtrToPtr);
-+         _3 = copy _12 as *mut u8 (PtrToPtr);
+          _3 = move _4 as *mut u8 (PtrToPtr);
           StorageDead(_4);
           StorageDead(_3);
 -         StorageDead(_1);
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
index 13258c17160..ebf305a6f1b 100644
--- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
@@ -31,7 +31,6 @@
               }
           }
           scope 9 (inlined NonNull::<[u8]>::as_ptr) {
-              let mut _17: *const [u8];
           }
       }
       scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
@@ -102,16 +101,9 @@
           StorageDead(_16);
           StorageDead(_12);
           StorageDead(_6);
--         StorageLive(_17);
-+         nop;
-          _17 = copy (_5.0: *const [u8]);
--         _4 = move _17 as *mut [u8] (PtrToPtr);
--         StorageDead(_17);
-+         _4 = copy _17 as *mut [u8] (PtrToPtr);
-+         nop;
+          _4 = copy _5 as *mut [u8] (Transmute);
           StorageDead(_5);
--         _3 = move _4 as *mut u8 (PtrToPtr);
-+         _3 = copy _17 as *mut u8 (PtrToPtr);
+          _3 = move _4 as *mut u8 (PtrToPtr);
           StorageDead(_4);
           StorageDead(_3);
 -         StorageDead(_1);
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
index 0821ea272bf..0c52f1e0583 100644
--- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
@@ -20,7 +20,6 @@
           scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
           }
           scope 6 (inlined NonNull::<[u8]>::as_ptr) {
-              let mut _12: *const [u8];
           }
       }
       scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
@@ -45,16 +44,9 @@
   
       bb1: {
           StorageDead(_6);
--         StorageLive(_12);
-+         nop;
-          _12 = copy (_5.0: *const [u8]);
--         _4 = move _12 as *mut [u8] (PtrToPtr);
--         StorageDead(_12);
-+         _4 = copy _12 as *mut [u8] (PtrToPtr);
-+         nop;
+          _4 = copy _5 as *mut [u8] (Transmute);
           StorageDead(_5);
--         _3 = move _4 as *mut u8 (PtrToPtr);
-+         _3 = copy _12 as *mut u8 (PtrToPtr);
+          _3 = move _4 as *mut u8 (PtrToPtr);
           StorageDead(_4);
           StorageDead(_3);
 -         StorageDead(_1);
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
index bd56ab67e00..a3308cc5df1 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
@@ -4,28 +4,28 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _13: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _21: std::option::Option<(usize, &T)>;
-    let mut _24: &impl Fn(usize, &T);
-    let mut _25: (usize, &T);
-    let _26: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _23: std::option::Option<(usize, &T)>;
+    let mut _26: &impl Fn(usize, &T);
+    let mut _27: (usize, &T);
+    let _28: ();
     scope 1 {
-        debug iter => _13;
-        let _22: usize;
-        let _23: &T;
+        debug iter => _15;
+        let _24: usize;
+        let _25: &T;
         scope 2 {
-            debug i => _22;
-            debug x => _23;
+            debug i => _24;
+            debug x => _25;
         }
         scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _14: &mut std::slice::Iter<'_, T>;
-            let mut _15: std::option::Option<&T>;
-            let mut _19: (usize, bool);
-            let mut _20: (usize, &T);
+            let mut _16: &mut std::slice::Iter<'_, T>;
+            let mut _17: std::option::Option<&T>;
+            let mut _21: (usize, bool);
+            let mut _22: (usize, &T);
             scope 19 {
-                let _18: usize;
+                let _20: usize;
                 scope 24 {
                 }
             }
@@ -40,8 +40,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                 }
             }
             scope 25 (inlined <Option<&T> as Try>::branch) {
-                let mut _16: isize;
-                let _17: &T;
+                let mut _18: isize;
+                let _19: &T;
                 scope 26 {
                 }
             }
@@ -50,13 +50,14 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -72,7 +73,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -87,76 +89,82 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb0: {
-        StorageLive(_11);
+        StorageLive(_13);
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
-        _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize };
+        StorageLive(_12);
+        _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
         StorageDead(_11);
-        StorageLive(_13);
-        _13 = copy _12;
+        StorageDead(_8);
+        StorageDead(_3);
+        _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _13, count: const 0_usize };
+        StorageDead(_13);
+        StorageLive(_15);
+        _15 = copy _14;
         goto -> bb4;
     }
 
     bb4: {
+        StorageLive(_23);
+        StorageLive(_20);
         StorageLive(_21);
-        StorageLive(_18);
-        StorageLive(_19);
-        StorageLive(_15);
-        StorageLive(_14);
-        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
-        _15 = <std::slice::Iter<'_, T> as Iterator>::next(move _14) -> [return: bb5, unwind unreachable];
+        StorageLive(_17);
+        StorageLive(_16);
+        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
+        _17 = <std::slice::Iter<'_, T> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        StorageDead(_14);
-        StorageLive(_16);
-        _16 = discriminant(_15);
-        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb11];
+        StorageDead(_16);
+        StorageLive(_18);
+        _18 = discriminant(_17);
+        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb11];
     }
 
     bb6: {
-        StorageDead(_16);
-        StorageDead(_15);
-        StorageDead(_19);
         StorageDead(_18);
+        StorageDead(_17);
         StorageDead(_21);
-        StorageDead(_13);
+        StorageDead(_20);
+        StorageDead(_23);
+        StorageDead(_15);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -165,35 +173,35 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb8: {
-        _17 = move ((_15 as Some).0: &T);
-        StorageDead(_16);
-        StorageDead(_15);
-        _18 = copy (_13.1: usize);
-        _19 = AddWithOverflow(copy (_13.1: usize), const 1_usize);
-        assert(!move (_19.1: bool), "attempt to compute `{} + {}`, which would overflow", copy (_13.1: usize), const 1_usize) -> [success: bb9, unwind unreachable];
+        _19 = move ((_17 as Some).0: &T);
+        StorageDead(_18);
+        StorageDead(_17);
+        _20 = copy (_15.1: usize);
+        _21 = AddWithOverflow(copy (_15.1: usize), const 1_usize);
+        assert(!move (_21.1: bool), "attempt to compute `{} + {}`, which would overflow", copy (_15.1: usize), const 1_usize) -> [success: bb9, unwind unreachable];
     }
 
     bb9: {
-        (_13.1: usize) = move (_19.0: usize);
-        StorageLive(_20);
-        _20 = (copy _18, copy _17);
-        _21 = Option::<(usize, &T)>::Some(move _20);
+        (_15.1: usize) = move (_21.0: usize);
+        StorageLive(_22);
+        _22 = (copy _20, copy _19);
+        _23 = Option::<(usize, &T)>::Some(move _22);
+        StorageDead(_22);
+        StorageDead(_21);
         StorageDead(_20);
-        StorageDead(_19);
-        StorageDead(_18);
-        _22 = copy (((_21 as Some).0: (usize, &T)).0: usize);
-        _23 = copy (((_21 as Some).0: (usize, &T)).1: &T);
-        StorageLive(_24);
-        _24 = &_2;
-        StorageLive(_25);
-        _25 = (copy _22, copy _23);
-        _26 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _24, move _25) -> [return: bb10, unwind unreachable];
+        _24 = copy (((_23 as Some).0: (usize, &T)).0: usize);
+        _25 = copy (((_23 as Some).0: (usize, &T)).1: &T);
+        StorageLive(_26);
+        _26 = &_2;
+        StorageLive(_27);
+        _27 = (copy _24, copy _25);
+        _28 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _26, move _27) -> [return: bb10, unwind unreachable];
     }
 
     bb10: {
-        StorageDead(_25);
-        StorageDead(_24);
-        StorageDead(_21);
+        StorageDead(_27);
+        StorageDead(_26);
+        StorageDead(_23);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
index 57f09a4631b..2a837fabd4c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
@@ -4,34 +4,35 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _13: std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _14: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
-    let mut _15: std::option::Option<(usize, &T)>;
-    let mut _16: isize;
-    let mut _19: &impl Fn(usize, &T);
-    let mut _20: (usize, &T);
-    let _21: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
+    let mut _17: std::option::Option<(usize, &T)>;
+    let mut _18: isize;
+    let mut _21: &impl Fn(usize, &T);
+    let mut _22: (usize, &T);
+    let _23: ();
     scope 1 {
-        debug iter => _13;
-        let _17: usize;
-        let _18: &T;
+        debug iter => _15;
+        let _19: usize;
+        let _20: &T;
         scope 2 {
-            debug i => _17;
-            debug x => _18;
+            debug i => _19;
+            debug x => _20;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -47,7 +48,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -62,66 +64,72 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb0: {
-        StorageLive(_11);
+        StorageLive(_13);
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
-        _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize };
+        StorageLive(_12);
+        _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
         StorageDead(_11);
-        StorageLive(_13);
-        _13 = copy _12;
+        StorageDead(_8);
+        StorageDead(_3);
+        _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _13, count: const 0_usize };
+        StorageDead(_13);
+        StorageLive(_15);
+        _15 = copy _14;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_15);
-        _14 = &mut _13;
-        _15 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _14) -> [return: bb5, unwind: bb11];
+        StorageLive(_17);
+        _16 = &mut _15;
+        _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        _16 = discriminant(_15);
-        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _18 = discriminant(_17);
+        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
+        StorageDead(_17);
         StorageDead(_15);
-        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -130,19 +138,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
     }
 
     bb8: {
-        _17 = copy (((_15 as Some).0: (usize, &T)).0: usize);
-        _18 = copy (((_15 as Some).0: (usize, &T)).1: &T);
-        StorageLive(_19);
-        _19 = &_2;
-        StorageLive(_20);
-        _20 = (copy _17, copy _18);
-        _21 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
+        _19 = copy (((_17 as Some).0: (usize, &T)).0: usize);
+        _20 = copy (((_17 as Some).0: (usize, &T)).1: &T);
+        StorageLive(_21);
+        _21 = &_2;
+        StorageLive(_22);
+        _22 = (copy _19, copy _20);
+        _23 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_20);
-        StorageDead(_19);
-        StorageDead(_15);
+        StorageDead(_22);
+        StorageDead(_21);
+        StorageDead(_17);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 4050304f469..063045caebb 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -4,31 +4,32 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::slice::Iter<'_, T>;
-    let mut _13: &mut std::slice::Iter<'_, T>;
-    let mut _14: std::option::Option<&T>;
-    let mut _15: isize;
-    let mut _17: &impl Fn(&T);
-    let mut _18: (&T,);
-    let _19: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::slice::Iter<'_, T>;
+    let mut _15: &mut std::slice::Iter<'_, T>;
+    let mut _16: std::option::Option<&T>;
+    let mut _17: isize;
+    let mut _19: &impl Fn(&T);
+    let mut _20: (&T,);
+    let _21: ();
     scope 1 {
-        debug iter => _12;
-        let _16: &T;
+        debug iter => _14;
+        let _18: &T;
         scope 2 {
-            debug x => _16;
+            debug x => _18;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -44,7 +45,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -56,62 +58,68 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
 
     bb0: {
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
         StorageLive(_12);
         _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
+        StorageDead(_11);
+        StorageDead(_8);
+        StorageDead(_3);
+        StorageLive(_14);
+        _14 = copy _13;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_14);
-        _13 = &mut _12;
-        _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind unreachable];
+        StorageLive(_16);
+        _15 = &mut _14;
+        _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        _15 = discriminant(_14);
-        switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _17 = discriminant(_16);
+        switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
+        StorageDead(_16);
         StorageDead(_14);
-        StorageDead(_12);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -120,18 +128,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _16 = copy ((_14 as Some).0: &T);
-        StorageLive(_17);
-        _17 = &_2;
-        StorageLive(_18);
-        _18 = (copy _16,);
-        _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
+        _18 = copy ((_16 as Some).0: &T);
+        StorageLive(_19);
+        _19 = &_2;
+        StorageLive(_20);
+        _20 = (copy _18,);
+        _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind unreachable];
     }
 
     bb9: {
-        StorageDead(_18);
-        StorageDead(_17);
-        StorageDead(_14);
+        StorageDead(_20);
+        StorageDead(_19);
+        StorageDead(_16);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 2c3d7ab1e4a..d401ed8fcf3 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -4,31 +4,32 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::slice::Iter<'_, T>;
-    let mut _13: &mut std::slice::Iter<'_, T>;
-    let mut _14: std::option::Option<&T>;
-    let mut _15: isize;
-    let mut _17: &impl Fn(&T);
-    let mut _18: (&T,);
-    let _19: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::slice::Iter<'_, T>;
+    let mut _15: &mut std::slice::Iter<'_, T>;
+    let mut _16: std::option::Option<&T>;
+    let mut _17: isize;
+    let mut _19: &impl Fn(&T);
+    let mut _20: (&T,);
+    let _21: ();
     scope 1 {
-        debug iter => _12;
-        let _16: &T;
+        debug iter => _14;
+        let _18: &T;
         scope 2 {
-            debug x => _16;
+            debug x => _18;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -44,7 +45,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -56,62 +58,68 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
 
     bb0: {
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
         StorageLive(_12);
         _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
+        StorageDead(_11);
+        StorageDead(_8);
+        StorageDead(_3);
+        StorageLive(_14);
+        _14 = copy _13;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_14);
-        _13 = &mut _12;
-        _14 = <std::slice::Iter<'_, T> as Iterator>::next(move _13) -> [return: bb5, unwind: bb11];
+        StorageLive(_16);
+        _15 = &mut _14;
+        _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        _15 = discriminant(_14);
-        switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
+        _17 = discriminant(_16);
+        switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
+        StorageDead(_16);
         StorageDead(_14);
-        StorageDead(_12);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -120,18 +128,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _16 = copy ((_14 as Some).0: &T);
-        StorageLive(_17);
-        _17 = &_2;
-        StorageLive(_18);
-        _18 = (copy _16,);
-        _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11];
+        _18 = copy ((_16 as Some).0: &T);
+        StorageLive(_19);
+        _19 = &_2;
+        StorageLive(_20);
+        _20 = (copy _18,);
+        _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_18);
-        StorageDead(_17);
-        StorageDead(_14);
+        StorageDead(_20);
+        StorageDead(_19);
+        StorageDead(_16);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
index a6ccd435c40..deb12c4f1c2 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
@@ -4,34 +4,35 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _13: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _15: std::option::Option<&T>;
-    let mut _16: isize;
-    let mut _18: &impl Fn(&T);
-    let mut _19: (&T,);
-    let _20: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _17: std::option::Option<&T>;
+    let mut _18: isize;
+    let mut _20: &impl Fn(&T);
+    let mut _21: (&T,);
+    let _22: ();
     scope 1 {
-        debug iter => _13;
-        let _17: &T;
+        debug iter => _15;
+        let _19: &T;
         scope 2 {
-            debug x => _17;
+            debug x => _19;
         }
         scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _14: &mut std::slice::Iter<'_, T>;
+            let mut _16: &mut std::slice::Iter<'_, T>;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -47,7 +48,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -62,68 +64,74 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb0: {
-        StorageLive(_11);
+        StorageLive(_13);
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
-        _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 };
+        StorageLive(_12);
+        _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
         StorageDead(_11);
-        StorageLive(_13);
-        _13 = copy _12;
+        StorageDead(_8);
+        StorageDead(_3);
+        _14 = Rev::<std::slice::Iter<'_, T>> { iter: copy _13 };
+        StorageDead(_13);
+        StorageLive(_15);
+        _15 = copy _14;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_15);
-        StorageLive(_14);
-        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
-        _15 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _14) -> [return: bb5, unwind unreachable];
+        StorageLive(_17);
+        StorageLive(_16);
+        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
+        _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable];
     }
 
     bb5: {
-        StorageDead(_14);
-        _16 = discriminant(_15);
-        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
+        StorageDead(_16);
+        _18 = discriminant(_17);
+        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
+        StorageDead(_17);
         StorageDead(_15);
-        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind unreachable];
     }
 
@@ -132,18 +140,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _17 = copy ((_15 as Some).0: &T);
-        StorageLive(_18);
-        _18 = &_2;
-        StorageLive(_19);
-        _19 = (copy _17,);
-        _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind unreachable];
+        _19 = copy ((_17 as Some).0: &T);
+        StorageLive(_20);
+        _20 = &_2;
+        StorageLive(_21);
+        _21 = (copy _19,);
+        _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable];
     }
 
     bb9: {
-        StorageDead(_19);
-        StorageDead(_18);
-        StorageDead(_15);
+        StorageDead(_21);
+        StorageDead(_20);
+        StorageDead(_17);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index df11c8e3b49..acd5323eb7a 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -4,34 +4,35 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     debug slice => _1;
     debug f => _2;
     let mut _0: ();
-    let mut _11: std::slice::Iter<'_, T>;
-    let mut _12: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _13: std::iter::Rev<std::slice::Iter<'_, T>>;
-    let mut _15: std::option::Option<&T>;
-    let mut _16: isize;
-    let mut _18: &impl Fn(&T);
-    let mut _19: (&T,);
-    let _20: ();
+    let mut _13: std::slice::Iter<'_, T>;
+    let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
+    let mut _17: std::option::Option<&T>;
+    let mut _18: isize;
+    let mut _20: &impl Fn(&T);
+    let mut _21: (&T,);
+    let _22: ();
     scope 1 {
-        debug iter => _13;
-        let _17: &T;
+        debug iter => _15;
+        let _19: &T;
         scope 2 {
-            debug x => _17;
+            debug x => _19;
         }
         scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
-            let mut _14: &mut std::slice::Iter<'_, T>;
+            let mut _16: &mut std::slice::Iter<'_, T>;
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) {
         scope 4 (inlined std::slice::Iter::<'_, T>::new) {
             let _3: usize;
-            let mut _7: *mut T;
-            let mut _8: *mut T;
-            let mut _10: *const T;
+            let mut _5: std::ptr::NonNull<[T]>;
+            let mut _9: *mut T;
+            let mut _10: *mut T;
+            let mut _12: *const T;
             scope 5 {
-                let _6: std::ptr::NonNull<T>;
+                let _8: std::ptr::NonNull<T>;
                 scope 6 {
-                    let _9: *const T;
+                    let _11: *const T;
                     scope 7 {
                     }
                     scope 12 (inlined without_provenance::<T>) {
@@ -47,7 +48,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
                     }
                 }
                 scope 10 (inlined NonNull::<[T]>::cast::<T>) {
-                    let mut _5: *const T;
+                    let mut _6: *mut [T];
+                    let mut _7: *const T;
                     scope 11 (inlined NonNull::<[T]>::as_ptr) {
                     }
                 }
@@ -62,68 +64,74 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb0: {
-        StorageLive(_11);
+        StorageLive(_13);
         StorageLive(_3);
-        StorageLive(_6);
-        StorageLive(_4);
-        StorageLive(_5);
+        StorageLive(_8);
         _3 = PtrMetadata(copy _1);
+        StorageLive(_5);
+        StorageLive(_4);
         _4 = &raw const (*_1);
-        _5 = copy _4 as *const T (PtrToPtr);
-        _6 = NonNull::<T> { pointer: copy _5 };
-        StorageLive(_9);
+        _5 = NonNull::<[T]> { pointer: move _4 };
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _6 = copy _5 as *mut [T] (Transmute);
+        _7 = copy _6 as *const T (PtrToPtr);
+        _8 = NonNull::<T> { pointer: move _7 };
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageDead(_5);
+        StorageLive(_11);
         switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2];
     }
 
     bb1: {
-        StorageLive(_8);
-        StorageLive(_7);
-        _7 = copy _4 as *mut T (PtrToPtr);
-        _8 = Offset(copy _7, copy _3);
-        StorageDead(_7);
-        _9 = move _8 as *const T (PtrToPtr);
-        StorageDead(_8);
+        StorageLive(_10);
+        StorageLive(_9);
+        _9 = copy _8 as *mut T (Transmute);
+        _10 = Offset(copy _9, copy _3);
+        StorageDead(_9);
+        _11 = move _10 as *const T (PtrToPtr);
+        StorageDead(_10);
         goto -> bb3;
     }
 
     bb2: {
-        _9 = copy _3 as *const T (Transmute);
+        _11 = copy _3 as *const T (Transmute);
         goto -> bb3;
     }
 
     bb3: {
-        StorageLive(_10);
-        _10 = copy _9;
-        _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> };
-        StorageDead(_10);
-        StorageDead(_9);
-        StorageDead(_5);
-        StorageDead(_4);
-        StorageDead(_6);
-        StorageDead(_3);
-        _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 };
+        StorageLive(_12);
+        _12 = copy _11;
+        _13 = std::slice::Iter::<'_, T> { ptr: copy _8, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+        StorageDead(_12);
         StorageDead(_11);
-        StorageLive(_13);
-        _13 = copy _12;
+        StorageDead(_8);
+        StorageDead(_3);
+        _14 = Rev::<std::slice::Iter<'_, T>> { iter: copy _13 };
+        StorageDead(_13);
+        StorageLive(_15);
+        _15 = copy _14;
         goto -> bb4;
     }
 
     bb4: {
-        StorageLive(_15);
-        StorageLive(_14);
-        _14 = &mut (_13.0: std::slice::Iter<'_, T>);
-        _15 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _14) -> [return: bb5, unwind: bb11];
+        StorageLive(_17);
+        StorageLive(_16);
+        _16 = &mut (_15.0: std::slice::Iter<'_, T>);
+        _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11];
     }
 
     bb5: {
-        StorageDead(_14);
-        _16 = discriminant(_15);
-        switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10];
+        StorageDead(_16);
+        _18 = discriminant(_17);
+        switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
     }
 
     bb6: {
+        StorageDead(_17);
         StorageDead(_15);
-        StorageDead(_13);
         drop(_2) -> [return: bb7, unwind continue];
     }
 
@@ -132,18 +140,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb8: {
-        _17 = copy ((_15 as Some).0: &T);
-        StorageLive(_18);
-        _18 = &_2;
-        StorageLive(_19);
-        _19 = (copy _17,);
-        _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind: bb11];
+        _19 = copy ((_17 as Some).0: &T);
+        StorageLive(_20);
+        _20 = &_2;
+        StorageLive(_21);
+        _21 = (copy _19,);
+        _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11];
     }
 
     bb9: {
-        StorageDead(_19);
-        StorageDead(_18);
-        StorageDead(_15);
+        StorageDead(_21);
+        StorageDead(_20);
+        StorageDead(_17);
         goto -> bb4;
     }
 
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir
index f8b0e749bfc..22be48c47b2 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir
@@ -15,11 +15,11 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool {
             scope 4 {
                 scope 8 (inlined <NonNull<T> as PartialEq>::eq) {
                     let mut _5: std::ptr::NonNull<T>;
+                    let mut _6: *mut T;
+                    let mut _7: *mut T;
                     scope 9 (inlined NonNull::<T>::as_ptr) {
-                        let mut _6: *const T;
                     }
                     scope 10 (inlined NonNull::<T>::as_ptr) {
-                        let mut _7: *const T;
                     }
                 }
             }
@@ -48,13 +48,13 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool {
         _4 = copy (*_3);
         StorageDead(_3);
         StorageLive(_6);
-        StorageLive(_7);
         StorageLive(_5);
         _5 = copy ((*_1).0: std::ptr::NonNull<T>);
-        _6 = copy (_5.0: *const T);
+        _6 = copy _5 as *mut T (Transmute);
         StorageDead(_5);
-        _7 = copy (_4.0: *const T);
-        _0 = Eq(copy _6, copy _7);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (Transmute);
+        _0 = Eq(move _6, move _7);
         StorageDead(_7);
         StorageDead(_6);
         goto -> bb3;
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir
index f8b0e749bfc..22be48c47b2 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir
@@ -15,11 +15,11 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool {
             scope 4 {
                 scope 8 (inlined <NonNull<T> as PartialEq>::eq) {
                     let mut _5: std::ptr::NonNull<T>;
+                    let mut _6: *mut T;
+                    let mut _7: *mut T;
                     scope 9 (inlined NonNull::<T>::as_ptr) {
-                        let mut _6: *const T;
                     }
                     scope 10 (inlined NonNull::<T>::as_ptr) {
-                        let mut _7: *const T;
                     }
                 }
             }
@@ -48,13 +48,13 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool {
         _4 = copy (*_3);
         StorageDead(_3);
         StorageLive(_6);
-        StorageLive(_7);
         StorageLive(_5);
         _5 = copy ((*_1).0: std::ptr::NonNull<T>);
-        _6 = copy (_5.0: *const T);
+        _6 = copy _5 as *mut T (Transmute);
         StorageDead(_5);
-        _7 = copy (_4.0: *const T);
-        _0 = Eq(copy _6, copy _7);
+        StorageLive(_7);
+        _7 = copy _4 as *mut T (Transmute);
+        _0 = Eq(move _6, move _7);
         StorageDead(_7);
         StorageDead(_6);
         goto -> bb3;
diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
index c3091bd4395..2efbb6d9904 100644
--- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir
@@ -7,16 +7,18 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
         debug self => _1;
         scope 2 (inlined Vec::<u8>::as_slice) {
             debug self => _1;
-            let mut _7: usize;
+            let mut _9: *const u8;
+            let mut _10: usize;
             scope 3 (inlined Vec::<u8>::as_ptr) {
                 debug self => _1;
                 let mut _2: &alloc::raw_vec::RawVec<u8>;
+                let mut _8: *mut u8;
                 scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
                     debug self => _2;
                     let mut _3: &alloc::raw_vec::RawVecInner;
                     scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
                         debug self => _3;
-                        let mut _6: std::ptr::NonNull<u8>;
+                        let mut _7: std::ptr::NonNull<u8>;
                         scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
                             debug self => _3;
                             let mut _4: std::ptr::NonNull<u8>;
@@ -25,27 +27,28 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                                 debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
                                 scope 8 (inlined NonNull::<u8>::cast::<u8>) {
                                     debug self => _4;
+                                    let mut _5: *mut u8;
+                                    let mut _6: *const u8;
                                     scope 9 (inlined NonNull::<u8>::as_ptr) {
                                         debug self => _4;
-                                        let mut _5: *const u8;
                                     }
                                 }
                             }
                             scope 10 (inlined Unique::<u8>::as_non_null_ptr) {
-                                debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _6;
+                                debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _7;
                                 debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
                             }
                         }
                         scope 11 (inlined NonNull::<u8>::as_ptr) {
-                            debug self => _6;
+                            debug self => _7;
                         }
                     }
                 }
             }
             scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
-                debug data => _5;
-                debug len => _7;
-                let _8: *const [u8];
+                debug data => _9;
+                debug len => _10;
+                let _11: *const [u8];
                 scope 13 (inlined core::ub_checks::check_language_ub) {
                     scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
                     }
@@ -55,11 +58,11 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 scope 16 (inlined align_of::<u8>) {
                 }
                 scope 17 (inlined slice_from_raw_parts::<u8>) {
-                    debug data => _5;
-                    debug len => _7;
+                    debug data => _9;
+                    debug len => _10;
                     scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
-                        debug data_pointer => _5;
-                        debug metadata => _7;
+                        debug data_pointer => _9;
+                        debug metadata => _10;
                     }
                 }
             }
@@ -67,26 +70,37 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
     }
 
     bb0: {
+        StorageLive(_8);
+        StorageLive(_9);
         StorageLive(_2);
         _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>);
         StorageLive(_3);
         _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner);
-        StorageLive(_6);
+        StorageLive(_7);
         StorageLive(_4);
         _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
-        _5 = copy (_4.0: *const u8);
-        _6 = NonNull::<u8> { pointer: copy _5 };
-        StorageDead(_4);
+        StorageLive(_5);
+        StorageLive(_6);
+        _5 = copy _4 as *mut u8 (Transmute);
+        _6 = copy _5 as *const u8 (PtrToPtr);
+        _7 = NonNull::<u8> { pointer: move _6 };
         StorageDead(_6);
+        StorageDead(_5);
+        StorageDead(_4);
+        _8 = copy _7 as *mut u8 (Transmute);
+        StorageDead(_7);
         StorageDead(_3);
+        _9 = copy _8 as *const u8 (PtrToPtr);
         StorageDead(_2);
-        StorageLive(_7);
-        _7 = copy ((*_1).1: usize);
-        StorageLive(_8);
-        _8 = *const [u8] from (copy _5, copy _7);
-        _0 = &(*_8);
+        StorageLive(_10);
+        _10 = copy ((*_1).1: usize);
+        StorageLive(_11);
+        _11 = *const [u8] from (copy _9, copy _10);
+        _0 = &(*_11);
+        StorageDead(_11);
+        StorageDead(_10);
+        StorageDead(_9);
         StorageDead(_8);
-        StorageDead(_7);
         return;
     }
 }
diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
index c3091bd4395..2efbb6d9904 100644
--- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir
@@ -7,16 +7,18 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
         debug self => _1;
         scope 2 (inlined Vec::<u8>::as_slice) {
             debug self => _1;
-            let mut _7: usize;
+            let mut _9: *const u8;
+            let mut _10: usize;
             scope 3 (inlined Vec::<u8>::as_ptr) {
                 debug self => _1;
                 let mut _2: &alloc::raw_vec::RawVec<u8>;
+                let mut _8: *mut u8;
                 scope 4 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
                     debug self => _2;
                     let mut _3: &alloc::raw_vec::RawVecInner;
                     scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
                         debug self => _3;
-                        let mut _6: std::ptr::NonNull<u8>;
+                        let mut _7: std::ptr::NonNull<u8>;
                         scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
                             debug self => _3;
                             let mut _4: std::ptr::NonNull<u8>;
@@ -25,27 +27,28 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                                 debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
                                 scope 8 (inlined NonNull::<u8>::cast::<u8>) {
                                     debug self => _4;
+                                    let mut _5: *mut u8;
+                                    let mut _6: *const u8;
                                     scope 9 (inlined NonNull::<u8>::as_ptr) {
                                         debug self => _4;
-                                        let mut _5: *const u8;
                                     }
                                 }
                             }
                             scope 10 (inlined Unique::<u8>::as_non_null_ptr) {
-                                debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _6;
+                                debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _7;
                                 debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>;
                             }
                         }
                         scope 11 (inlined NonNull::<u8>::as_ptr) {
-                            debug self => _6;
+                            debug self => _7;
                         }
                     }
                 }
             }
             scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) {
-                debug data => _5;
-                debug len => _7;
-                let _8: *const [u8];
+                debug data => _9;
+                debug len => _10;
+                let _11: *const [u8];
                 scope 13 (inlined core::ub_checks::check_language_ub) {
                     scope 14 (inlined core::ub_checks::check_language_ub::runtime) {
                     }
@@ -55,11 +58,11 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
                 scope 16 (inlined align_of::<u8>) {
                 }
                 scope 17 (inlined slice_from_raw_parts::<u8>) {
-                    debug data => _5;
-                    debug len => _7;
+                    debug data => _9;
+                    debug len => _10;
                     scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
-                        debug data_pointer => _5;
-                        debug metadata => _7;
+                        debug data_pointer => _9;
+                        debug metadata => _10;
                     }
                 }
             }
@@ -67,26 +70,37 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] {
     }
 
     bb0: {
+        StorageLive(_8);
+        StorageLive(_9);
         StorageLive(_2);
         _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>);
         StorageLive(_3);
         _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner);
-        StorageLive(_6);
+        StorageLive(_7);
         StorageLive(_4);
         _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
-        _5 = copy (_4.0: *const u8);
-        _6 = NonNull::<u8> { pointer: copy _5 };
-        StorageDead(_4);
+        StorageLive(_5);
+        StorageLive(_6);
+        _5 = copy _4 as *mut u8 (Transmute);
+        _6 = copy _5 as *const u8 (PtrToPtr);
+        _7 = NonNull::<u8> { pointer: move _6 };
         StorageDead(_6);
+        StorageDead(_5);
+        StorageDead(_4);
+        _8 = copy _7 as *mut u8 (Transmute);
+        StorageDead(_7);
         StorageDead(_3);
+        _9 = copy _8 as *const u8 (PtrToPtr);
         StorageDead(_2);
-        StorageLive(_7);
-        _7 = copy ((*_1).1: usize);
-        StorageLive(_8);
-        _8 = *const [u8] from (copy _5, copy _7);
-        _0 = &(*_8);
+        StorageLive(_10);
+        _10 = copy ((*_1).1: usize);
+        StorageLive(_11);
+        _11 = *const [u8] from (copy _9, copy _10);
+        _0 = &(*_11);
+        StorageDead(_11);
+        StorageDead(_10);
+        StorageDead(_9);
         StorageDead(_8);
-        StorageDead(_7);
         return;
     }
 }
diff --git a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
index fd6644d73c1..b83e576076d 100644
--- a/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
+++ b/tests/ui-fulldeps/pprust-parenthesis-insertion.rs
@@ -36,12 +36,11 @@ extern crate rustc_errors;
 extern crate rustc_parse;
 extern crate rustc_session;
 extern crate rustc_span;
-extern crate smallvec;
 
 use std::mem;
 use std::process::ExitCode;
 
-use rustc_ast::ast::{DUMMY_NODE_ID, Expr, ExprKind, Stmt};
+use rustc_ast::ast::{DUMMY_NODE_ID, Expr, ExprKind};
 use rustc_ast::mut_visit::{self, DummyAstNode as _, MutVisitor};
 use rustc_ast::node_id::NodeId;
 use rustc_ast::ptr::P;
@@ -50,7 +49,6 @@ use rustc_errors::Diag;
 use rustc_parse::parser::Recovery;
 use rustc_session::parse::ParseSess;
 use rustc_span::{DUMMY_SP, FileName, Span};
-use smallvec::SmallVec;
 
 // Every parenthesis in the following expressions is re-inserted by the
 // pretty-printer.
@@ -164,18 +162,6 @@ impl MutVisitor for Normalize {
     fn visit_span(&mut self, span: &mut Span) {
         *span = DUMMY_SP;
     }
-
-    fn visit_expr(&mut self, expr: &mut P<Expr>) {
-        if let ExprKind::Binary(binop, _left, _right) = &mut expr.kind {
-            self.visit_span(&mut binop.span);
-        }
-        mut_visit::walk_expr(self, expr);
-    }
-
-    fn flat_map_stmt(&mut self, mut stmt: Stmt) -> SmallVec<[Stmt; 1]> {
-        self.visit_span(&mut stmt.span);
-        mut_visit::walk_flat_map_stmt(self, stmt)
-    }
 }
 
 fn parse_expr(psess: &ParseSess, source_code: &str) -> Option<P<Expr>> {
diff --git a/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs
index d163238c6d5..5a67d34d6e5 100644
--- a/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs
+++ b/tests/ui/const-generics/issues/cg-in-dyn-issue-128176.rs
@@ -1,6 +1,7 @@
 //@ check-pass
 
-// Regression test for #128176.
+// Regression test for #128176. Previously we would call `type_of` on the `1` anon const
+// before the anon const had been lowered and had the `type_of` fed with a result.
 
 #![feature(generic_const_exprs)]
 #![feature(dyn_compatible_for_dispatch)]
diff --git a/tests/ui/coroutine/coroutine-in-orphaned-anon-const.rs b/tests/ui/coroutine/coroutine-in-orphaned-anon-const.rs
index 07c13239a2c..c98ec1de17e 100644
--- a/tests/ui/coroutine/coroutine-in-orphaned-anon-const.rs
+++ b/tests/ui/coroutine/coroutine-in-orphaned-anon-const.rs
@@ -3,8 +3,6 @@
 trait X {
     fn test() -> Self::Assoc<{ async {} }>;
     //~^ ERROR associated type `Assoc` not found for `Self`
-    //~| ERROR associated type `Assoc` not found for `Self`
-
 }
 
 pub fn main() {}
diff --git a/tests/ui/coroutine/coroutine-in-orphaned-anon-const.stderr b/tests/ui/coroutine/coroutine-in-orphaned-anon-const.stderr
index 864c6556d79..58553728753 100644
--- a/tests/ui/coroutine/coroutine-in-orphaned-anon-const.stderr
+++ b/tests/ui/coroutine/coroutine-in-orphaned-anon-const.stderr
@@ -4,14 +4,6 @@ error[E0220]: associated type `Assoc` not found for `Self`
 LL |     fn test() -> Self::Assoc<{ async {} }>;
    |                        ^^^^^ associated type `Assoc` not found
 
-error[E0220]: associated type `Assoc` not found for `Self`
-  --> $DIR/coroutine-in-orphaned-anon-const.rs:4:24
-   |
-LL |     fn test() -> Self::Assoc<{ async {} }>;
-   |                        ^^^^^ associated type `Assoc` not found
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs
index deef35cdf70..da25c854c54 100644
--- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs
+++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs
@@ -29,7 +29,7 @@ struct NoFieldUnit<'a, #[pointee] T: ?Sized>();
 struct NoGeneric<'a>(&'a u8);
 
 #[derive(CoercePointee)]
-//~^ ERROR: exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits
+//~^ ERROR: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits
 #[repr(transparent)]
 struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> {
     a: (&'a T1, &'a T2),
@@ -38,7 +38,7 @@ struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> {
 #[derive(CoercePointee)]
 #[repr(transparent)]
 struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B));
-//~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits
+//~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
 
 #[derive(CoercePointee)]
 //~^ ERROR: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`
@@ -49,7 +49,7 @@ struct NotTransparent<'a, #[pointee] T: ?Sized> {
 #[derive(CoercePointee)]
 #[repr(transparent)]
 struct NoMaybeSized<'a, #[pointee] T> {
-    //~^ ERROR: `derive(CoercePointee)` requires T to be marked `?Sized`
+    //~^ ERROR: `derive(CoercePointee)` requires `T` to be marked `?Sized`
     ptr: &'a T,
 }
 
diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
index e590d636d0e..c1e8be49d37 100644
--- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
+++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr
@@ -30,7 +30,7 @@ LL | #[derive(CoercePointee)]
    |
    = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits
+error: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits
   --> $DIR/deriving-coerce-pointee-neg.rs:31:10
    |
 LL | #[derive(CoercePointee)]
@@ -38,11 +38,11 @@ LL | #[derive(CoercePointee)]
    |
    = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits
+error: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
   --> $DIR/deriving-coerce-pointee-neg.rs:40:39
    |
 LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B));
-   |                                       ^                     ^
+   |                                       ^                     - here another type parameter is marked as `#[pointee]`
 
 error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`
   --> $DIR/deriving-coerce-pointee-neg.rs:43:10
@@ -52,7 +52,7 @@ LL | #[derive(CoercePointee)]
    |
    = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: `derive(CoercePointee)` requires T to be marked `?Sized`
+error: `derive(CoercePointee)` requires `T` to be marked `?Sized`
   --> $DIR/deriving-coerce-pointee-neg.rs:51:36
    |
 LL | struct NoMaybeSized<'a, #[pointee] T> {
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr
index 72646b7bc76..9e04e90a98a 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr
@@ -1,5 +1,5 @@
 error[E0284]: type annotations needed: cannot satisfy `Foo == _`
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:16:19
+  --> $DIR/norm-before-method-resolution-opaque-type.rs:15:19
    |
 LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
    |                   ^ cannot satisfy `Foo == _`
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
index dbd0d5dc733..479f5984355 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr
@@ -1,5 +1,5 @@
 error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:16:4
+  --> $DIR/norm-before-method-resolution-opaque-type.rs:15:4
    |
 LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
    |    ^^^^^^^^^^^
@@ -11,16 +11,8 @@ note: this opaque type is in the signature
 LL | type Foo = impl Sized;
    |            ^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:13:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   |
-   = note: `Foo` must be used in combination with a concrete type within the same module
-
 error[E0507]: cannot move out of `*x` which is behind a shared reference
-  --> $DIR/norm-before-method-resolution-opaque-type.rs:23:13
+  --> $DIR/norm-before-method-resolution-opaque-type.rs:22:13
    |
 LL |     let x = *x;
    |             ^^ move occurs because `*x` has type `<X as Trait<'_>>::Out<Foo>`, which does not implement the `Copy` trait
@@ -31,6 +23,6 @@ LL -     let x = *x;
 LL +     let x = x;
    |
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
index cf752f814c9..ffbfc622bb0 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
@@ -11,7 +11,6 @@ impl<'a, T> Trait<'a> for T {
 }
 
 type Foo = impl Sized;
-//[old]~^ ERROR: unconstrained opaque type
 
 fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X
 //[old]~^ ERROR: item does not constrain
diff --git a/tests/ui/impl-trait/issues/issue-86800.rs b/tests/ui/impl-trait/issues/issue-86800.rs
index 5a6959ad7e6..ff1d273ae48 100644
--- a/tests/ui/impl-trait/issues/issue-86800.rs
+++ b/tests/ui/impl-trait/issues/issue-86800.rs
@@ -23,7 +23,6 @@ struct Context {
 type TransactionResult<O> = Result<O, ()>;
 
 type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
-//~^ ERROR unconstrained opaque type
 
 fn execute_transaction_fut<'f, F, O>(
     //~^ ERROR: item does not constrain
diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr
index 095f648143c..fd9b8e7ac99 100644
--- a/tests/ui/impl-trait/issues/issue-86800.stderr
+++ b/tests/ui/impl-trait/issues/issue-86800.stderr
@@ -1,5 +1,5 @@
 error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:28:4
+  --> $DIR/issue-86800.rs:27:4
    |
 LL | fn execute_transaction_fut<'f, F, O>(
    |    ^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResu
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:40:14
+  --> $DIR/issue-86800.rs:39:14
    |
 LL |     async fn do_transaction<O>(
    |              ^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResu
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: item does not constrain `TransactionFuture::{opaque#0}`, but has it in its signature
-  --> $DIR/issue-86800.rs:44:5
+  --> $DIR/issue-86800.rs:43:5
    |
 LL | /     {
 LL | |
@@ -43,16 +43,8 @@ note: this opaque type is in the signature
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/issue-86800.rs:25:34
-   |
-LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
-   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `TransactionFuture` must be used in combination with a concrete type within the same module
-
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/issue-86800.rs:35:5
+  --> $DIR/issue-86800.rs:34:5
    |
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                        --- this generic parameter must be used with a generic lifetime parameter
@@ -61,7 +53,7 @@ LL |     f
    |     ^
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/issue-86800.rs:44:5
+  --> $DIR/issue-86800.rs:43:5
    |
 LL |   type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                          --- this generic parameter must be used with a generic lifetime parameter
@@ -75,6 +67,6 @@ LL | |         f(&mut transaction).await
 LL | |     }
    | |_____^
 
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
index dc9424c3ca7..3f41c5984b4 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.rs
@@ -2,7 +2,6 @@
 
 mod a {
     type Foo = impl PartialEq<(Foo, i32)>;
-    //~^ ERROR: unconstrained opaque type
 
     struct Bar;
 
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
index 6485aa20710..b127bf41800 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
@@ -1,5 +1,5 @@
 error[E0053]: method `eq` has an incompatible type for trait
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:30
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:30
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                -------------------------- the found opaque type
@@ -15,7 +15,7 @@ LL |         fn eq(&self, _other: &(a::Bar, i32)) -> bool {
    |                              ~~~~~~~~~~~~~~
 
 error: item does not constrain `a::Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:10:12
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:12
    |
 LL |         fn eq(&self, _other: &(Foo, i32)) -> bool {
    |            ^^
@@ -27,16 +27,8 @@ note: this opaque type is in the signature
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
-   |
-LL |     type Foo = impl PartialEq<(Foo, i32)>;
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `Foo` must be used in combination with a concrete type within the same module
-
 error[E0053]: method `eq` has an incompatible type for trait
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:25:30
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:30
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                -------------------------- the expected opaque type
@@ -47,7 +39,7 @@ LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    = note: expected signature `fn(&b::Bar, &(b::Foo, _)) -> _`
               found signature `fn(&b::Bar, &(b::Bar, _)) -> _`
 note: this item must have the opaque type in its signature in order to be able to register hidden types
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:25:12
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:12
    |
 LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    |            ^^
@@ -57,13 +49,13 @@ LL |         fn eq(&self, _other: &(b::Foo, i32)) -> bool {
    |                              ~~~~~~~~~~~~~~
 
 error: unconstrained opaque type
-  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:19:16
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16
    |
 LL |     type Foo = impl PartialEq<(Foo, i32)>;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `Foo` must be used in combination with a concrete type within the same module
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr b/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
index b70676ece0e..7d02a0606fc 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
+++ b/tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr
@@ -11,14 +11,6 @@ note: this opaque type is in the signature
 LL | type A = impl Foo;
    |          ^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/two_tait_defining_each_other2.rs:6:10
-   |
-LL | type A = impl Foo;
-   |          ^^^^^^^^
-   |
-   = note: `A` must be used in combination with a concrete type within the same module
-
 error: opaque type's hidden type cannot be another opaque type from the same scope
   --> $DIR/two_tait_defining_each_other2.rs:14:5
    |
@@ -36,5 +28,5 @@ note: opaque type being used as hidden type
 LL | type A = impl Foo;
    |          ^^^^^^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.rs b/tests/ui/impl-trait/two_tait_defining_each_other2.rs
index 3311c556568..1681b019418 100644
--- a/tests/ui/impl-trait/two_tait_defining_each_other2.rs
+++ b/tests/ui/impl-trait/two_tait_defining_each_other2.rs
@@ -3,7 +3,7 @@
 //@[next] compile-flags: -Znext-solver
 #![feature(type_alias_impl_trait)]
 
-type A = impl Foo; //[current]~ ERROR unconstrained opaque type
+type A = impl Foo;
 type B = impl Foo;
 
 trait Foo {}
diff --git a/tests/ui/nll/closure-requirements/thread_scope_correct_implied_bound.rs b/tests/ui/nll/closure-requirements/thread_scope_correct_implied_bound.rs
new file mode 100644
index 00000000000..e2b3b051ea8
--- /dev/null
+++ b/tests/ui/nll/closure-requirements/thread_scope_correct_implied_bound.rs
@@ -0,0 +1,23 @@
+// This example broke while refactoring the way closure
+// requirements are handled. The setup here matches
+// `thread::scope`.
+
+//@ check-pass
+
+struct Outlives<'hr, 'scope: 'hr>(*mut (&'scope (), &'hr ()));
+impl<'hr, 'scope> Outlives<'hr, 'scope> {
+    fn outlives_hr<T: 'hr>(self) {}
+}
+
+fn takes_closure_implied_bound<'scope>(f: impl for<'hr> FnOnce(Outlives<'hr, 'scope>)) {}
+
+fn requires_external_outlives_hr<T>() {
+    // implied bounds:
+    // - `T: 'scope` as `'scope` is local to this function
+    // - `'scope: 'hr` as it's an implied bound of `Outlives`
+    //
+    // need to prove `T: 'hr` :>
+    takes_closure_implied_bound(|proof| proof.outlives_hr::<T>());
+}
+
+fn main() {}
diff --git a/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.rs b/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.rs
new file mode 100644
index 00000000000..cfc8980410a
--- /dev/null
+++ b/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.rs
@@ -0,0 +1,21 @@
+// This example incorrectly compiled while refactoring the way
+// closure requirements are handled.
+
+struct Outlives<'hr: 'scope, 'scope>(*mut (&'scope (), &'hr ()));
+impl<'hr, 'scope> Outlives<'hr, 'scope> {
+    fn outlives_hr<T: 'hr>(self) {}
+}
+
+fn takes_closure_implied_bound<'scope>(f: impl for<'hr> FnOnce(Outlives<'hr, 'scope>)) {}
+
+fn requires_external_outlives_hr<T>() {
+    // implied bounds:
+    // - `T: 'scope` as `'scope` is local to this function
+    // - `'hr: 'scope` as it's an implied bound of `Outlives`
+    //
+    // need to prove `T: 'hr` :<
+    takes_closure_implied_bound(|proof| proof.outlives_hr::<T>());
+    //~^ ERROR the parameter type `T` may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.stderr b/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.stderr
new file mode 100644
index 00000000000..e22673c249f
--- /dev/null
+++ b/tests/ui/nll/closure-requirements/thread_scope_incorrect_implied_bound.stderr
@@ -0,0 +1,17 @@
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/thread_scope_incorrect_implied_bound.rs:17:47
+   |
+LL |     takes_closure_implied_bound(|proof| proof.outlives_hr::<T>());
+   |                                               ^^^^^^^^^^^
+   |                                               |
+   |                                               the parameter type `T` must be valid for the static lifetime...
+   |                                               ...so that the type `T` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL | fn requires_external_outlives_hr<T: 'static>() {
+   |                                   +++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/nll/ty-outlives/projection-implied-bounds.rs b/tests/ui/nll/ty-outlives/projection-implied-bounds.rs
index 7d983adfe88..c6572d60bb0 100644
--- a/tests/ui/nll/ty-outlives/projection-implied-bounds.rs
+++ b/tests/ui/nll/ty-outlives/projection-implied-bounds.rs
@@ -1,8 +1,6 @@
 // Test that we can deduce when projections like `T::Item` outlive the
 // function body. Test that this does not imply that `T: 'a` holds.
 
-//@ compile-flags:-Zverbose-internals
-
 use std::cell::Cell;
 
 fn twice<F, T>(mut value: T, mut f: F)
diff --git a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
index 2aab03ee7b7..5d5b890151d 100644
--- a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
+++ b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
@@ -1,5 +1,5 @@
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/projection-implied-bounds.rs:30:36
+  --> $DIR/projection-implied-bounds.rs:28:36
    |
 LL |     twice(value, |value_ref, item| invoke2(value_ref, item));
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/self/arbitrary-self-opaque.rs b/tests/ui/self/arbitrary-self-opaque.rs
index 3c2e2d9db72..c26ef658b69 100644
--- a/tests/ui/self/arbitrary-self-opaque.rs
+++ b/tests/ui/self/arbitrary-self-opaque.rs
@@ -2,7 +2,6 @@
 struct Foo;
 
 type Bar = impl Sized;
-//~^ ERROR unconstrained opaque type
 
 impl Foo {
     fn foo(self: Bar) {}
diff --git a/tests/ui/self/arbitrary-self-opaque.stderr b/tests/ui/self/arbitrary-self-opaque.stderr
index 5634b3d6e64..c75165d9f8e 100644
--- a/tests/ui/self/arbitrary-self-opaque.stderr
+++ b/tests/ui/self/arbitrary-self-opaque.stderr
@@ -1,5 +1,5 @@
 error[E0307]: invalid `self` parameter type: `Bar`
-  --> $DIR/arbitrary-self-opaque.rs:8:18
+  --> $DIR/arbitrary-self-opaque.rs:7:18
    |
 LL |     fn foo(self: Bar) {}
    |                  ^^^
@@ -8,7 +8,7 @@ LL |     fn foo(self: Bar) {}
    = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
 
 error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/arbitrary-self-opaque.rs:8:8
+  --> $DIR/arbitrary-self-opaque.rs:7:8
    |
 LL |     fn foo(self: Bar) {}
    |        ^^^
@@ -20,14 +20,6 @@ note: this opaque type is in the signature
 LL | type Bar = impl Sized;
    |            ^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/arbitrary-self-opaque.rs:4:12
-   |
-LL | type Bar = impl Sized;
-   |            ^^^^^^^^^^
-   |
-   = note: `Bar` must be used in combination with a concrete type within the same module
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0307`.
diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs
index 48a98efea5e..0da68afb592 100644
--- a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs
+++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs
@@ -3,7 +3,6 @@
 trait X {
     fn a<T>() -> T::unknown<{}> {}
     //~^ ERROR: associated type `unknown` not found for `T`
-    //~| ERROR: associated type `unknown` not found for `T`
 }
 
 trait Y {
@@ -14,7 +13,6 @@ trait Y {
 trait Z<T> {
     fn a() -> T::unknown<{}> {}
     //~^ ERROR: associated type `unknown` not found for `T`
-    //~| ERROR: associated type `unknown` not found for `T`
 }
 
 fn main() {}
diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr
index 9598c373e6e..49e41f75ff3 100644
--- a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr
+++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr
@@ -5,34 +5,18 @@ LL |     fn a<T>() -> T::unknown<{}> {}
    |                     ^^^^^^^ associated type `unknown` not found
 
 error[E0220]: associated type `unknown` not found for `T`
-  --> $DIR/unknown-assoc-with-const-arg.rs:15:18
+  --> $DIR/unknown-assoc-with-const-arg.rs:14:18
    |
 LL |     fn a() -> T::unknown<{}> {}
    |                  ^^^^^^^ associated type `unknown` not found
 
-error[E0220]: associated type `unknown` not found for `T`
-  --> $DIR/unknown-assoc-with-const-arg.rs:4:21
-   |
-LL |     fn a<T>() -> T::unknown<{}> {}
-   |                     ^^^^^^^ associated type `unknown` not found
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error[E0220]: associated type `unknown` not found for `T`
-  --> $DIR/unknown-assoc-with-const-arg.rs:15:18
-   |
-LL |     fn a() -> T::unknown<{}> {}
-   |                  ^^^^^^^ associated type `unknown` not found
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
 error[E0433]: failed to resolve: use of undeclared type `NOT_EXIST`
-  --> $DIR/unknown-assoc-with-const-arg.rs:10:15
+  --> $DIR/unknown-assoc-with-const-arg.rs:9:15
    |
 LL |     fn a() -> NOT_EXIST::unknown<{}> {}
    |               ^^^^^^^^^ use of undeclared type `NOT_EXIST`
 
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0220, E0433.
 For more information about an error, try `rustc --explain E0220`.
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
index 18cfb1c1f93..4b2ee344aa3 100644
--- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
@@ -3,7 +3,6 @@
 #![feature(type_alias_impl_trait)]
 trait Trait<T> {}
 type Alias<'a, U> = impl Trait<U>;
-//~^ ERROR unconstrained opaque type
 
 pub enum UninhabitedVariants {
     Tuple(Alias),
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
index cf366c55ea8..55df117d066 100644
--- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
@@ -1,5 +1,5 @@
 error[E0106]: missing lifetime specifier
-  --> $DIR/bad-tait-no-substs.rs:9:11
+  --> $DIR/bad-tait-no-substs.rs:8:11
    |
 LL |     Tuple(Alias),
    |           ^^^^^ expected named lifetime parameter
@@ -11,7 +11,7 @@ LL ~     Tuple(Alias<'a>),
    |
 
 error[E0107]: missing generics for type alias `Alias`
-  --> $DIR/bad-tait-no-substs.rs:9:11
+  --> $DIR/bad-tait-no-substs.rs:8:11
    |
 LL |     Tuple(Alias),
    |           ^^^^^ expected 1 generic argument
@@ -27,7 +27,7 @@ LL |     Tuple(Alias<U>),
    |                +++
 
 error[E0792]: non-defining opaque type use in defining scope
-  --> $DIR/bad-tait-no-substs.rs:9:11
+  --> $DIR/bad-tait-no-substs.rs:8:11
    |
 LL |     Tuple(Alias),
    |           ^^^^^ argument `'_` is not a generic parameter
@@ -39,7 +39,7 @@ LL | type Alias<'a, U> = impl Trait<U>;
    |                     ^^^^^^^^^^^^^
 
 error: item does not constrain `Alias::{opaque#0}`, but has it in its signature
-  --> $DIR/bad-tait-no-substs.rs:15:4
+  --> $DIR/bad-tait-no-substs.rs:14:4
    |
 LL | fn uwu(x: UninhabitedVariants) {
    |    ^^^
@@ -51,22 +51,14 @@ note: this opaque type is in the signature
 LL | type Alias<'a, U> = impl Trait<U>;
    |                     ^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/bad-tait-no-substs.rs:5:21
-   |
-LL | type Alias<'a, U> = impl Trait<U>;
-   |                     ^^^^^^^^^^^^^
-   |
-   = note: `Alias` must be used in combination with a concrete type within the same module
-
 error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` not covered
-  --> $DIR/bad-tait-no-substs.rs:17:11
+  --> $DIR/bad-tait-no-substs.rs:16:11
    |
 LL |     match x {}
    |           ^ pattern `UninhabitedVariants::Tuple(_)` not covered
    |
 note: `UninhabitedVariants` defined here
-  --> $DIR/bad-tait-no-substs.rs:8:10
+  --> $DIR/bad-tait-no-substs.rs:7:10
    |
 LL | pub enum UninhabitedVariants {
    |          ^^^^^^^^^^^^^^^^^^^
@@ -80,7 +72,7 @@ LL +         UninhabitedVariants::Tuple(_) => todo!(),
 LL +     }
    |
 
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0004, E0106, E0107, E0792.
 For more information about an error, try `rustc --explain E0004`.
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
index b7999a695e7..5b77bb6c2bc 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.infer.stderr
@@ -1,5 +1,5 @@
 error: `Bar` is forbidden as the type of a const generic parameter
-  --> $DIR/const_generic_type.rs:8:24
+  --> $DIR/const_generic_type.rs:7:24
    |
 LL | async fn test<const N: crate::Bar>() {
    |                        ^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
index ec8a51b0818..8888f2d49df 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
@@ -1,5 +1,5 @@
 error: `Bar` is forbidden as the type of a const generic parameter
-  --> $DIR/const_generic_type.rs:8:24
+  --> $DIR/const_generic_type.rs:7:24
    |
 LL | async fn test<const N: crate::Bar>() {
    |                        ^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | async fn test<const N: crate::Bar>() {
    = note: the only supported types are integers, `bool`, and `char`
 
 error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/const_generic_type.rs:8:10
+  --> $DIR/const_generic_type.rs:7:10
    |
 LL | async fn test<const N: crate::Bar>() {
    |          ^^^^
@@ -20,7 +20,7 @@ LL | type Bar = impl std::fmt::Display;
    |            ^^^^^^^^^^^^^^^^^^^^^^
 
 error: item does not constrain `Bar::{opaque#0}`, but has it in its signature
-  --> $DIR/const_generic_type.rs:8:38
+  --> $DIR/const_generic_type.rs:7:38
    |
 LL |   async fn test<const N: crate::Bar>() {
    |  ______________________________________^
@@ -39,13 +39,5 @@ note: this opaque type is in the signature
 LL | type Bar = impl std::fmt::Display;
    |            ^^^^^^^^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/const_generic_type.rs:5:12
-   |
-LL | type Bar = impl std::fmt::Display;
-   |            ^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `Bar` must be used in combination with a concrete type within the same module
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.rs b/tests/ui/type-alias-impl-trait/const_generic_type.rs
index de493d04f81..7149370048b 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.rs
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.rs
@@ -3,7 +3,6 @@
 
 #![feature(type_alias_impl_trait)]
 type Bar = impl std::fmt::Display;
-//[no_infer]~^ ERROR: unconstrained opaque type
 
 async fn test<const N: crate::Bar>() {
     //~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
index 96c905ef3a9..fd06ea677c3 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
@@ -8,7 +8,6 @@
 use std::future::Future;
 
 type FutNothing<'a> = impl 'a + Future<Output = ()>;
-//~^ ERROR: unconstrained opaque type
 
 async fn operation(_: &mut ()) -> () {
     //~^ ERROR: concrete type differs from previous
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
index 0c2772683a9..08ebc3208d7 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
@@ -1,5 +1,5 @@
 error: item does not constrain `FutNothing::{opaque#0}`, but has it in its signature
-  --> $DIR/hkl_forbidden4.rs:19:10
+  --> $DIR/hkl_forbidden4.rs:18:10
    |
 LL | async fn call<F>(_f: F)
    |          ^^^^
@@ -12,7 +12,7 @@ LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: item does not constrain `FutNothing::{opaque#0}`, but has it in its signature
-  --> $DIR/hkl_forbidden4.rs:23:1
+  --> $DIR/hkl_forbidden4.rs:22:1
    |
 LL | / {
 LL | |
@@ -27,16 +27,8 @@ note: this opaque type is in the signature
 LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/hkl_forbidden4.rs:10:23
-   |
-LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `FutNothing` must be used in combination with a concrete type within the same module
-
 error[E0792]: expected generic lifetime parameter, found `'any`
-  --> $DIR/hkl_forbidden4.rs:15:5
+  --> $DIR/hkl_forbidden4.rs:14:5
    |
 LL | async fn operation(_: &mut ()) -> () {
    |                       - this generic parameter must be used with a generic lifetime parameter
@@ -45,19 +37,19 @@ LL |     call(operation).await
    |     ^^^^^^^^^^^^^^^
 
 error: concrete type differs from previous defining opaque type use
-  --> $DIR/hkl_forbidden4.rs:13:1
+  --> $DIR/hkl_forbidden4.rs:12:1
    |
 LL | async fn operation(_: &mut ()) -> () {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FutNothing<'_>`, got `{async fn body of operation()}`
    |
 note: previous use here
-  --> $DIR/hkl_forbidden4.rs:15:5
+  --> $DIR/hkl_forbidden4.rs:14:5
    |
 LL |     call(operation).await
    |     ^^^^^^^^^^^^^^^
 
 error[E0792]: expected generic lifetime parameter, found `'any`
-  --> $DIR/hkl_forbidden4.rs:23:1
+  --> $DIR/hkl_forbidden4.rs:22:1
    |
 LL |   type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                   -- this generic parameter must be used with a generic lifetime parameter
@@ -68,6 +60,6 @@ LL | |
 LL | | }
    | |_^
 
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
index a7d824c5a6a..aaf2812532d 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference3.rs
@@ -4,7 +4,6 @@
 use std::fmt::Debug;
 
 type FooX = impl Debug;
-//~^ ERROR unconstrained opaque type
 
 trait Foo<A> {}
 
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
index 9ccd9544896..969409ebc59 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr
@@ -1,5 +1,5 @@
 error: item does not constrain `FooX::{opaque#0}`, but has it in its signature
-  --> $DIR/nested-tait-inference3.rs:13:4
+  --> $DIR/nested-tait-inference3.rs:12:4
    |
 LL | fn foo() -> impl Foo<FooX> {
    |    ^^^
@@ -11,13 +11,5 @@ note: this opaque type is in the signature
 LL | type FooX = impl Debug;
    |             ^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/nested-tait-inference3.rs:6:13
-   |
-LL | type FooX = impl Debug;
-   |             ^^^^^^^^^^
-   |
-   = note: `FooX` must be used in combination with a concrete type within the same module
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
index 3954672500b..41238c27351 100644
--- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
+++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.rs
@@ -5,7 +5,6 @@
 
 mod foo {
     pub type Foo = impl Copy;
-    //~^ ERROR unconstrained opaque type
 
     // make compiler happy about using 'Foo'
     pub fn bar(x: Foo) -> Foo {
diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
index d95a4a8a727..eed88c5df4f 100644
--- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
+++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr
@@ -1,5 +1,5 @@
 error: item does not constrain `Foo::{opaque#0}`, but has it in its signature
-  --> $DIR/no_inferrable_concrete_type.rs:11:12
+  --> $DIR/no_inferrable_concrete_type.rs:10:12
    |
 LL |     pub fn bar(x: Foo) -> Foo {
    |            ^^^
@@ -11,13 +11,5 @@ note: this opaque type is in the signature
 LL |     pub type Foo = impl Copy;
    |                    ^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/no_inferrable_concrete_type.rs:7:20
-   |
-LL |     pub type Foo = impl Copy;
-   |                    ^^^^^^^^^
-   |
-   = note: `Foo` must be used in combination with a concrete type within the same module
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error