RFR: 8311125: Remove unused parameter 'phase' in AllocateNode::Ideal_allocation

Christian Hagedorn chagedorn at openjdk.org
Fri Jun 30 06:54:55 UTC 2023


On Thu, 29 Jun 2023 22:46:57 GMT, Xin Liu <xliu at openjdk.org> wrote:

> There are 2 overloaded AllocateNode::Idea_allocation() in graphkit.cpp.
> One of them never uses 'phase' in the pattern-matching effort.
> 
> C++ compiler may emit a warning for the unused parameter. We will need to take care of it if we treat 
> warning as error. It also unnecessarily couple CheckCastPP with PhaseValue. In some places, we have to
> gain the instance for it. 
> 
> I would like to remove 'phase' as parameter. This is a pure clean-up. The other Idea_allocation() does 
> use PhaseValue* phase to get constant nodes, so leave it alone.

Otherwise, the cleanup looks good.

src/hotspot/share/opto/memnode.cpp line 632:

> 630: 
> 631:       if (ac != nullptr && ac->is_clonebasic()) {
> 632:         AllocateNode* alloc = AllocateNode::Ideal_allocation(ac->in(ArrayCopyNode::Dest));

You can also remove the `phase` parameter of this method since this was the only usage.

src/hotspot/share/opto/memnode.cpp line 1716:

> 1714: }
> 1715: 
> 1716: AllocateNode* LoadNode::is_new_object_mark_load(PhaseGVN *phase) const {

You can also remove the `phase` parameter of this method since there is now no usage left.

src/hotspot/share/opto/parse1.cpp line 1014:

> 1012:     // then barrier introduced by allocation node can be removed.
> 1013:     if (DoEscapeAnalysis && alloc_with_final()) {
> 1014:       AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final());

Suggestion:

      AllocateNode* alloc = AllocateNode::Ideal_allocation(alloc_with_final());

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14719#pullrequestreview-1506605427
PR Review Comment: https://git.openjdk.org/jdk/pull/14719#discussion_r1247498636
PR Review Comment: https://git.openjdk.org/jdk/pull/14719#discussion_r1247497126
PR Review Comment: https://git.openjdk.org/jdk/pull/14719#discussion_r1247500189


More information about the hotspot-compiler-dev mailing list