Skip to content

Commit

Permalink
8223143: Restructure/clean-up for 'loopexit_or_null()'.
Browse files Browse the repository at this point in the history
Minor restructure and clean-up for 'loopexit_or_null()' and its use.

Backport-of: 8088ed8
  • Loading branch information
TheRealMDoerr committed Mar 9, 2022
1 parent 571d323 commit bca1970
Showing 1 changed file with 41 additions and 19 deletions.
60 changes: 41 additions & 19 deletions src/hotspot/share/opto/loopnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,26 +370,49 @@ class CountedLoopEndNode : public IfNode {
};


inline CountedLoopEndNode *CountedLoopNode::loopexit_or_null() const {
Node *bc = back_control();
if( bc == NULL ) return NULL;
Node *le = bc->in(0);
if( le->Opcode() != Op_CountedLoopEnd )
return NULL;
return (CountedLoopEndNode*)le;
inline CountedLoopEndNode* CountedLoopNode::loopexit_or_null() const {
Node* bctrl = back_control();
if (bctrl == NULL) return NULL;

Node* lexit = bctrl->in(0);
return (CountedLoopEndNode*)
(lexit->Opcode() == Op_CountedLoopEnd ? lexit : NULL);
}
inline CountedLoopEndNode *CountedLoopNode::loopexit() const {

inline CountedLoopEndNode* CountedLoopNode::loopexit() const {
CountedLoopEndNode* cle = loopexit_or_null();
assert(cle != NULL, "loopexit is NULL");
return cle;
}
inline Node *CountedLoopNode::init_trip() const { return loopexit_or_null() ? loopexit()->init_trip() : NULL; }
inline Node *CountedLoopNode::stride() const { return loopexit_or_null() ? loopexit()->stride() : NULL; }
inline int CountedLoopNode::stride_con() const { return loopexit_or_null() ? loopexit()->stride_con() : 0; }
inline bool CountedLoopNode::stride_is_con() const { return loopexit_or_null() && loopexit()->stride_is_con(); }
inline Node *CountedLoopNode::limit() const { return loopexit_or_null() ? loopexit()->limit() : NULL; }
inline Node *CountedLoopNode::incr() const { return loopexit_or_null() ? loopexit()->incr() : NULL; }
inline Node *CountedLoopNode::phi() const { return loopexit_or_null() ? loopexit()->phi() : NULL; }

inline Node* CountedLoopNode::init_trip() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->init_trip() : NULL;
}
inline Node* CountedLoopNode::stride() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->stride() : NULL;
}
inline int CountedLoopNode::stride_con() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->stride_con() : 0;
}
inline bool CountedLoopNode::stride_is_con() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL && cle->stride_is_con();
}
inline Node* CountedLoopNode::limit() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->limit() : NULL;
}
inline Node* CountedLoopNode::incr() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->incr() : NULL;
}
inline Node* CountedLoopNode::phi() const {
CountedLoopEndNode* cle = loopexit_or_null();
return cle != NULL ? cle->phi() : NULL;
}

//------------------------------LoopLimitNode-----------------------------
// Counted Loop limit node which represents exact final iterator value:
Expand Down Expand Up @@ -635,8 +658,8 @@ class IdealLoopTree : public ResourceObj {
};

// -----------------------------PhaseIdealLoop---------------------------------
// Computes the mapping from Nodes to IdealLoopTrees. Organizes IdealLoopTrees into a
// loop tree. Drives the loop-based transformations on the ideal graph.
// Computes the mapping from Nodes to IdealLoopTrees. Organizes IdealLoopTrees
// into a loop tree. Drives the loop-based transformations on the ideal graph.
class PhaseIdealLoop : public PhaseTransform {
friend class IdealLoopTree;
friend class SuperWord;
Expand Down Expand Up @@ -735,8 +758,7 @@ class PhaseIdealLoop : public PhaseTransform {
}
Node *dom_lca_for_get_late_ctrl_internal( Node *lca, Node *n, Node *tag );

// Helper function for directing control inputs away from CFG split
// points.
// Helper function for directing control inputs away from CFG split points.
Node *find_non_split_ctrl( Node *ctrl ) const {
if (ctrl != NULL) {
if (ctrl->is_MultiBranch()) {
Expand Down

1 comment on commit bca1970

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.