RFR: 8371581: C2: PhaseCCP should reach fixpoint by revisiting deeply-Value-d nodes [v2]

Aleksey Shipilev shade at openjdk.org
Thu Nov 13 13:24:42 UTC 2025


On Thu, 13 Nov 2025 12:49:47 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - More restrictive CmpP check
>>  - Tighten up comments and signatures
>>  - Do Value() once
>
> src/hotspot/share/opto/phaseX.cpp line 2850:
> 
>> 2848: // Add nodes here if particular *Node::Value is doing deep graph traversals
>> 2849: // not handled by push_more_uses.
>> 2850: bool PhaseCCP::needs_revisit(Node *n) const {
> 
> Suggestion:
> 
> bool PhaseCCP::needs_revisit(Node* n) const {

Done.

> src/hotspot/share/opto/phaseX.cpp line 2856:
> 
>> 2854:   }
>> 2855:   // CmpPNode performs deep traversals if it compares oopptr. CmpP is not notified for changes far away.
>> 2856:   if (n->Opcode() == Op_CmpP) {
> 
> The verification restricts it to `n->Opcode() == Op_CmpP && type(n->in(1))->isa_oopptr() && type(n->in(2))->isa_oopptr()`. How big is the difference here? Might this have a performance impact?

Honestly, no idea. I just wanted to have a conservative check, e.g. "We know `CmpP` does something fishy? We are going to revisit it." But it will make sense to keep C2 compilation fast. Let me try to add the oopptr checks and see if anything shows up in CTW.

> src/hotspot/share/opto/phaseX.cpp line 2875:
> 
>> 2873:   // We should either make sure that these nodes are properly added back to the CCP worklist
>> 2874:   // in PhaseCCP::push_child_nodes_to_worklist() to update their type in the same round,
>> 2875:   // or that they are added in PhaseCCP::maybe_needs_revisit() so that analysis revisits
> 
> Suggestion:
> 
>   // or that they are added in PhaseCCP::needs_revisit() so that analysis revisits

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28288#discussion_r2523433941
PR Review Comment: https://git.openjdk.org/jdk/pull/28288#discussion_r2523442427
PR Review Comment: https://git.openjdk.org/jdk/pull/28288#discussion_r2523434127


More information about the hotspot-compiler-dev mailing list