Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369002

Extract the loop->is_member(get_loop(get_ctrl(node))) pattern in a new function

XMLWordPrintable

      A very common pattern in loop optimizations is the following:

      node_ctrl = get_ctrl(node);
      if (loop->is_member(get_loop(node))) { ... }

      In PhaseIdealLoop, there is already:

      int is_member( const IdealLoopTree *loop, Node *n ) const {
          return loop->is_member(get_loop(n)); }

      We should have a similar version that also takes care of the get_ctrl call, and replace the occurrences of this common pattern with the new function.

      The return type of the existing PhaseIdealLoop::is_member should also be changed to bool to be consistent with IdealLoopTree::is_member.

      This was originally suggested by [~roland] in this comment: https://github.com/openjdk/jdk/pull/27225#discussion_r2391684977

            Unassigned Unassigned
            bmaillard BenoƮt Maillard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: