RFR: 8355970: C2: Add command line option to print the compile phases [v6]
Christian Hagedorn
chagedorn at openjdk.org
Thu May 15 06:35:06 UTC 2025
On Wed, 14 May 2025 15:00:30 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:
>> This PR introduces the flag `-XX:PrintPhaseLevel` that works like the flag `-XX:PrintIdealGraphLevel` and prints the name phases of a C2 compilation (essentially what we have in the left side bar in IGV) to the terminal. This allows redirecting the output to a file and comparing phase decisions between two compilations. Further, it is useful in conjunction with loop opts tracing to immediately see in which phase a certain optimization happened.
>>
>> <details>
>> <summary>Output with `-XX:PrintPhaseLevel=2`</summary>
>>
>>
>>> java-fastdebug -Xbatch -XX:CompileCommand=compileonly,TestLoop.test10 -XX:CompileCommand=printcompilation,TestLoop.test* -XX:PrintPhaseLevel=2 TestLoop.java
>> CompileCommand: compileonly TestLoop.test10 bool compileonly = true
>> CompileCommand: PrintCompilation TestLoop.test* bool PrintCompilation = true
>> 3577 98 % b 3 TestLoop::test10 @ 2 (64 bytes)
>> 3584 99 b 3 TestLoop::test10 (64 bytes)
>> 3648 100 % b 4 TestLoop::test10 @ 2 (64 bytes)
>> 1. After Parsing
>> 2. Iter GVN 1
>> 3. Incremental Inline
>> 4. Incremental Boxing Inline
>> 5. Before Loop Optimizations
>> 6. PhaseIdealLoop 1
>> 7. PhaseIdealLoop 2
>> 8. PhaseIdealLoop 3
>> 9. Before PhaseCCP 1
>> 10. PhaseCCP 1
>> 11. Iter GVN 2
>> 12. PhaseIdealLoop iterations
>> 13. After Loop Optimizations
>> 14. After Macro Expansion
>> 15. Barrier expand
>> 16. Optimize finished
>> 17. Before matching
>> 18. After matching
>> 19. Global code motion
>> 20. Register Allocation
>> 21. Final Code
>> 3668 103 b 4 TestLoop::test10 (64 bytes)
>> 1. After Parsing
>> 2. Iter GVN 1
>> 3. Incremental Inline
>> 4. Incremental Boxing Inline
>> 5. Before Loop Optimizations
>> 6. PhaseIdealLoop 1
>> 7. PhaseIdealLoop 2
>> 8. PhaseIdealLoop 3
>> 9. Before PhaseCCP 1
>> 10. PhaseCCP 1
>> 11. Iter GVN 2
>> 12. PhaseIdealLoop iterations
>> 13. PhaseIdealLoop iterations 2
>> 14. PhaseIdealLoop iterations 3
>> 15. PhaseIdealLoop iterations 4
>> 16. PhaseIdealLoop iterations 5
>> 17. PhaseIdealLoop iterations 6
>> 18. PhaseIdealLoop iterations 7
>> 19. PhaseIdealLoop iterations 8
>> 20. PhaseIdealLoop iterations 9
>> 21. After Loop Optimizations
>> 22. After Macro Expansion
>> 23. Barrier expand
>> 24. Optimize finished
>> 25. Before matching
>> 26. After matching
>> 27. Global code motion
>> 28. Registe...
>
> Manuel Hässig has updated the pull request incrementally with one additional commit since the last revision:
>
> Apply suggestions from @chhagedorn
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
Marked as reviewed by chagedorn (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/25183#pullrequestreview-2842426158
More information about the hotspot-compiler-dev
mailing list