C2 enhanced node::dump() and supported a variety of options (JDK-8283775). One interesting option is "S: sort displayed nodes by node idx". I think it's good idea to upgrade root()->dump(9999) with it.
- root()->dump(9999);
+ // Print out all nodes in ascending order of index.
+ root()->dump_bfs(MaxNodeLimit, nullptr, "+S$");
The IR becomes much easier to read and we can compare 2 phases using diff. I remember Andrew Dinn introduced this idea in mailing list before. At that time, we have to rely on external program 'sort' .
In addition, COMPILER_PHASES has one flag 'DEBUG' not in use. I think we can use it to dump all phases like GCC does.
eg.
-XX:CompileCommand=PrintIdealPhase,java.lang.String::length,DEBUG