RFR: 8342662: C2: Add new phase for backend-specific lowering [v3]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Thu Oct 31 02:22:41 UTC 2024


On Wed, 30 Oct 2024 17:22:42 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>> 
>>  - Merge branch 'master' into phase-lowering
>>  - Remove platform-dependent node definitions, rework PhaseLowering implementation
>>  - Address some changes from code review
>>  - Implement PhaseLowering
>
> src/hotspot/share/opto/phaseX.cpp line 2273:
> 
>> 2271: 
>> 2272: Node* PhaseLowering::apply_ideal(Node* k, bool can_reshape) {
>> 2273:   // Run the lowered Ideal method to continue doing transformations on the node, while avoiding existing transforms
> 
> Can you call `lower(k)` here and as a result, you can simply do `lower.optimize()` as the main entry?

I would prefer to keep it as-is because `PhaseIterGVN::optimize` does a lot of logic that may not be relevant here (such as IGVN verification and IGV printing). This way we can avoid changes to IGVN in the future accidentally impacting lowering in unexpected ways.

> src/hotspot/share/opto/phaseX.cpp line 2289:
> 
>> 2287:   _worklist.ensure_empty();
>> 2288: 
>> 2289:   C->identify_useful_nodes(_worklist);
> 
> To address @iwanowww 's concern, you can have a backend-specific method `PhaseLowering::do_lowering()` that will decide whether we should perform lowering on a particular graph.

I think if we're planning on moving optimizations like `DivMod` to the platform-independent part of this phase we may end up processing nodes more generally, since the graph patterns we expect would be pretty wide and shared between multiple backends. What do you think?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21599#discussion_r1823694036
PR Review Comment: https://git.openjdk.org/jdk/pull/21599#discussion_r1823694120


More information about the hotspot-compiler-dev mailing list