RFR: 8343148: C2: Refactor uses of "PhaseValue::*con*() + PhaseIdealLoop::set_ctrl()" into separate method

Emanuel Peter epeter at openjdk.org
Thu Nov 7 07:55:43 UTC 2024


On Fri, 1 Nov 2024 16:04:38 GMT, theoweidmannoracle <duke at openjdk.org> wrote:

> This patch introduces the methods `PhaseIdealLoop::intcon` and `PhaseIdealLoop::longcon` which are wrappers for:
> 
> 
> ConINode* node = _igvn.intcon(i);
> set_ctrl(node, C->root());
> 
> 
> and
> 
> 
> ConLNode* node = _igvn.longcon(i);
> set_ctrl(node, C->root());
> 
> 
> Occurrences of this pattern in loopnode.cpp were replaced with the appropriate call to the new methods.

src/hotspot/share/opto/loopTransform.cpp line 2963:

> 2961:       // Kill the eliminated test
> 2962:       C->set_major_progress();
> 2963:       Node *kill_con = intcon(1-flip);

Suggestion:

      Node* kill_con = intcon(1-flip);

We generally now have the pointer `*` with the type. So if you touch any new code please update it ;)

src/hotspot/share/opto/loopopts.cpp line 334:

> 332:   }
> 333:   // 'con' is set to true or false to kill the dominated test.
> 334:   Node *con = makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);

Suggestion:

  Node* con = makecon(pop == Op_IfTrue ? TypeInt::ONE : TypeInt::ZERO);

src/hotspot/share/opto/loopopts.cpp line 2907:

> 2905:   int proj_con = live_proj->_con;
> 2906:   assert(proj_con == 0 || proj_con == 1, "false or true projection");
> 2907:   Node *con = intcon(proj_con);

Suggestion:

  Node* con = intcon(proj_con);

src/hotspot/share/opto/loopopts.cpp line 3245:

> 3243:          stay_in_loop(lp_proj, loop)->is_If() &&
> 3244:          stay_in_loop(lp_proj, loop)->in(1)->in(1)->Opcode() == Op_CmpU, "inserted cmpi before cmpu");
> 3245:   Node *con = makecon(lp_proj->is_IfTrue() ? TypeInt::ONE : TypeInt::ZERO);

Suggestion:

  Node* con = makecon(lp_proj->is_IfTrue() ? TypeInt::ONE : TypeInt::ZERO);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21836#discussion_r1832203491
PR Review Comment: https://git.openjdk.org/jdk/pull/21836#discussion_r1832204711
PR Review Comment: https://git.openjdk.org/jdk/pull/21836#discussion_r1832205017
PR Review Comment: https://git.openjdk.org/jdk/pull/21836#discussion_r1832205177


More information about the hotspot-compiler-dev mailing list