The expand_macro_nodes function [1] currently calls eliminate_macro_nodes [2] and also eliminates Opaque and LoopLimit nodes [3] before actually expanding macros. This is unintuitive and we should move the macro elimination code elsewhere.
In combination with the above change, we should also create a separate compiler phase PHASE_AFTER_MACRO_ELIMINATION. There is already a phase PHASE_ITER_GVN_AFTER_ELIMINATION for running macro elimination in another context prior to macro expansion [4]. We should perhaps also remove this phase in favor of the new PHASE_AFTER_MACRO_ELIMINATION.
Similarly toJDK-8317349, we could also add a StressMacroElimination option.
[1] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2432-L2635
[2] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2437
[3] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2442-L2521
[4] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/compile.cpp#L2358
In combination with the above change, we should also create a separate compiler phase PHASE_AFTER_MACRO_ELIMINATION. There is already a phase PHASE_ITER_GVN_AFTER_ELIMINATION for running macro elimination in another context prior to macro expansion [4]. We should perhaps also remove this phase in favor of the new PHASE_AFTER_MACRO_ELIMINATION.
Similarly to
[1] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2432-L2635
[2] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2437
[3] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/macro.cpp#L2442-L2521
[4] https://github.com/openjdk/jdk/blob/917838e0a564b1f2cbfb6cc214ccbfd1a237019f/src/hotspot/share/opto/compile.cpp#L2358
- relates to
-
JDK-8317349 Randomize order of macro node expansion in C2
-
- Resolved
-