diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index 995d8ba6072a08..ba7555485a3cd8 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -1313,6 +1313,7 @@ fn compile_iseq(iseq: IseqPtr) -> Option { if !get_option!(disable_hir_opt) { function.optimize(); } + function.dump_hir(); #[cfg(debug_assertions)] if let Err(err) = function.validate() { debug!("ZJIT: compile_iseq: {err:?}"); diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index c93a6858f18fab..b6e18e73562857 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -2143,7 +2143,10 @@ impl Function { #[cfg(debug_assertions)] self.assert_validates(); self.eliminate_dead_code(); #[cfg(debug_assertions)] self.assert_validates(); + } + /// Dump HIR passed to codegen if specified by options. + pub fn dump_hir(&self) { // Dump HIR after optimization match get_option!(dump_hir_opt) { Some(DumpHIR::WithoutSnapshot) => println!("Optimized HIR:\n{}", FunctionPrinter::without_snapshot(&self)), @@ -2157,7 +2160,6 @@ impl Function { } } - /// Validates the following: /// 1. Basic block jump args match parameter arity. /// 2. Every terminator must be in the last position.