RFR: 8305203: Simplify trimming operation in Region::Ideal

Tobias Hartmann thartmann at openjdk.org
Mon Apr 3 05:27:21 UTC 2023


On Thu, 30 Mar 2023 05:26:08 GMT, Xin Liu <xliu at openjdk.org> wrote:

> This patch improves how Region::Ideal trims unreachable paths. 
> 
> 1. Don't restart from beginning. Trimming doesn't change the DU-chain.
> 2. Replace DFIterator with DFIterator_Fast. The later is a raw pointer in release build.
> 3. Don't call add_users_to_worklist(this) repeatly.
> 4. Reduce its strength from add_users_to_worklist to
>    add_users_to_worklist0 because RegionNode has no special logic.
> 
> This patch also includes a cosmetic change: rename n to 'use' inside of the loop.
> Otherwise, we would overshadow Node* n = in(i). Nothing wrong but harder to read.

Looks good to me.

src/hotspot/share/opto/cfgnode.cpp line 575:

> 573:         Node* use = fast_out(j);
> 574: 
> 575:         if(use->req() != req() && use->is_Phi()) {

Suggestion:

        if (use->req() != req() && use->is_Phi()) {

src/hotspot/share/opto/cfgnode.cpp line 576:

> 574: 
> 575:         if(use->req() != req() && use->is_Phi()) {
> 576:           assert(use->in(0) == this, "");

Suggestion:

          assert(use->in(0) == this, "unexpected control input");

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

Marked as reviewed by thartmann (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13238#pullrequestreview-1368304294
PR Review Comment: https://git.openjdk.org/jdk/pull/13238#discussion_r1155492344
PR Review Comment: https://git.openjdk.org/jdk/pull/13238#discussion_r1155492682


More information about the hotspot-compiler-dev mailing list