about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-05-18 19:41:04 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-05-18 19:41:04 +0200
commitbeab7510cfbfb3aaa541922f2298b91b5bfff99d (patch)
tree0b94e51d1297ba2a524f134fcb4335faa6b2abf8
parenta9d033d0e5e29551fc578e8ea4eb3d5f43166b94 (diff)
downloadrust-beab7510cfbfb3aaa541922f2298b91b5bfff99d.tar.gz
rust-beab7510cfbfb3aaa541922f2298b91b5bfff99d.zip
Move some code around a bit
-rw-r--r--src/base.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/base.rs b/src/base.rs
index 2e16dc37c08..ec3e17e5b75 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -110,11 +110,6 @@ pub(crate) fn codegen_fn<'tcx>(
     // Verify function
     verify_func(tcx, &clif_comments, &context.func);
 
-    // Perform rust specific optimizations
-    tcx.sess.time("optimize clif ir", || {
-        crate::optimize::optimize_function(tcx, instance, context, &mut clif_comments);
-    });
-
     // If the return block is not reachable, then the SSA builder may have inserted an `iconst.i128`
     // instruction, which doesn't have an encoding.
     context.compute_cfg();
@@ -125,10 +120,14 @@ pub(crate) fn codegen_fn<'tcx>(
     // invalidate it when it would change.
     context.domtree.clear();
 
-    context.want_disasm = crate::pretty_clif::should_write_ir(tcx);
+    // Perform rust specific optimizations
+    tcx.sess.time("optimize clif ir", || {
+        crate::optimize::optimize_function(tcx, instance, context, &mut clif_comments);
+    });
 
     // Define function
     tcx.sess.time("define function", || {
+        context.want_disasm = crate::pretty_clif::should_write_ir(tcx);
         module
             .define_function(func_id, context, &mut NullTrapSink {}, &mut NullStackMapSink {})
             .unwrap()