RFR: 8325478: Restructure the macro expansion compiler phase to not include macro elimination [v7]
Vladimir Kozlov
kvn at openjdk.org
Mon Jun 30 16:28:43 UTC 2025
On Tue, 24 Jun 2025 16:32:11 GMT, Saranya Natarajan <snatarajan at openjdk.org> wrote:
>> This changeset restructures the macro expansion phase to not include macro elimination and also adds a flag StressMacroElimination which randomizes macro elimination ordering for stress testing purposes.
>>
>> Changes:
>> - Implemented a method `eliminate_opaque_looplimit_macro_nodes` that removes the functionality for eliminating Opaque and LoopLimit nodes from the `expand_macro_nodes ` method.
>> - Introduced compiler phases` PHASE_AFTER_MACRO_ELIMINATION`
>> - Added a new Ideal phase for individual macro elimination steps.
>> - Implemented the flag `StressMacroElimination`. Added functionality tests for `StressMacroElimination`, similar to previous stress flag `StressMacroExpansion` ([JDK-8317349](https://bugs.openjdk.org/browse/JDK-8317349)).
>>
>> Below is a sample screenshot (IGV print level 4 ) mainly showing the new phase .
>> 
>>
>> Questions to reviewers:
>> - Is the new macro elimination phase OK, or should we change anything?
>> - In `compile.cpp `, `PHASE_ITER_GVN_AFTER_ELIMINATION` follows `PHASE_AFTER_MACRO_ELIMINATION` in the current fix. Should `PHASE_ITER_GVN_AFTER_ELIMINATION` be removed ?
>>
>> Testing:
>> GitHub Actions
>> tier1 to tier5 on windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64.
>> Tested that thousands of graphs are correctly opened and visualized with IGV using the same test used in ([JDK-8317349](https://bugs.openjdk.org/browse/JDK-8317349))
>
> Saranya Natarajan has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>
> merge with master
> Merge branch 'master' of https://git.openjdk.org/jdk into JDK-8325478
I have few comments.
src/hotspot/share/opto/compile.cpp line 2533:
> 2531: {
> 2532: TracePhase tp(_t_macroExpand);
> 2533: print_method(PHASE_BEFORE_MACRO_EXPANSION, 3);
Should we move it before `mex.expand_macro_nodes()` call?
src/hotspot/share/opto/phasetype.hpp line 94:
> 92: flags(AFTER_LOOP_OPTS, "After Loop Optimizations") \
> 93: flags(AFTER_MERGE_STORES, "After Merge Stores") \
> 94: flags(AFTER_MACRO_ELIMINATION_STEP, "After Macro Elimination Step") \
What is the reason to not have `BEFORE_MACRO_ELIMINATION`?
src/utils/IdealGraphVisualizer/README.md line 36:
> 34: * `N=3`: additionally, after every minor phase
> 35: * `N=4`: additionally, after every loop optimization
> 36: * `N=5`: additionally, after every effective IGVN, macro elimination, and expansion step (slow)
Typo `,` before `, and`.
test/hotspot/jtreg/compiler/arguments/TestStressOptions.java line 59:
> 57: * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressUnstableIfTraps -XX:StressSeed=42
> 58: * compiler.arguments.TestStressOptions
> 59: * * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressMacroElimination
typo - double stars`* *`
-------------
PR Review: https://git.openjdk.org/jdk/pull/25682#pullrequestreview-2971878935
PR Review Comment: https://git.openjdk.org/jdk/pull/25682#discussion_r2175466142
PR Review Comment: https://git.openjdk.org/jdk/pull/25682#discussion_r2175462641
PR Review Comment: https://git.openjdk.org/jdk/pull/25682#discussion_r2175450582
PR Review Comment: https://git.openjdk.org/jdk/pull/25682#discussion_r2175448407
More information about the hotspot-compiler-dev
mailing list