diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 3dfcd14b38254..f221c82cdc61c 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -589,10 +589,12 @@ void Compile::print_ideal_ir(const char* phase_name) { compile_id(), is_osr_compilation() ? " compile_kind='osr'" : "", phase_name); - xtty->print("%s", ss.as_string()); // print to tty would use xml escape encoding + } + + tty->print("%s", ss.as_string()); + + if (xtty != nullptr) { xtty->tail("ideal"); - } else { - tty->print("%s", ss.as_string()); } } #endif