From cfedad1f75bf22468fce59f754daf1501fa2827d Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 16 Jan 2021 13:05:23 +0100 Subject: [PATCH] Clear domtree after cg_clif optimizations --- src/base.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/base.rs b/src/base.rs index 34c9561d6762..757915ba99a3 100644 --- a/src/base.rs +++ b/src/base.rs @@ -117,6 +117,9 @@ pub(crate) fn codegen_fn<'tcx>( context.compute_domtree(); context.eliminate_unreachable_code(cx.module.isa()).unwrap(); context.dce(cx.module.isa()).unwrap(); + // Some Cranelift optimizations expect the domtree to not yet be computed and as such don't + // invalidate it when it would change. + context.domtree.clear(); context.want_disasm = crate::pretty_clif::should_write_ir(tcx);