Skip to content

Commit dd7ab3d

Browse files
committed
8280696: C2 compilation hits assert(is_dominator(c, n_ctrl)) failed
Backport-of: fa1b56ede6eed653f70efbbfff3af5ee6b481ee4
1 parent 3269cec commit dd7ab3d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/hotspot/share/opto/cfgnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
21312131
doit = false;
21322132
break;
21332133
}
2134-
if (in(i)->in(AddPNode::Offset) != base) {
2134+
if (in(i)->in(AddPNode::Base) != base) {
21352135
base = NULL;
21362136
}
21372137
if (in(i)->in(AddPNode::Offset) != offset) {

src/hotspot/share/opto/loopopts.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,11 @@ Node *PhaseIdealLoop::has_local_phi_input( Node *n ) {
334334
// We allow the special case of AddP's with no local inputs.
335335
// This allows us to split-up address expressions.
336336
if (m->is_AddP() &&
337-
get_ctrl(m->in(2)) != n_ctrl &&
338-
get_ctrl(m->in(3)) != n_ctrl) {
339-
// Move the AddP up to dominating point
337+
get_ctrl(m->in(AddPNode::Base)) != n_ctrl &&
338+
get_ctrl(m->in(AddPNode::Address)) != n_ctrl &&
339+
get_ctrl(m->in(AddPNode::Offset)) != n_ctrl) {
340+
// Move the AddP up to the dominating point. That's fine because control of m's inputs
341+
// must dominate get_ctrl(m) == n_ctrl and we just checked that the input controls are != n_ctrl.
340342
Node* c = find_non_split_ctrl(idom(n_ctrl));
341343
if (c->is_OuterStripMinedLoop()) {
342344
c->as_Loop()->verify_strip_mined(1);
@@ -1603,6 +1605,8 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) {
16031605
}
16041606
}
16051607

1608+
// Compute the early control of a node by following its inputs until we reach
1609+
// nodes that are pinned. Then compute the LCA of the control of all pinned nodes.
16061610
Node* PhaseIdealLoop::compute_early_ctrl(Node* n, Node* n_ctrl) {
16071611
Node* early_ctrl = NULL;
16081612
ResourceMark rm;
@@ -1618,17 +1622,14 @@ Node* PhaseIdealLoop::compute_early_ctrl(Node* n, Node* n_ctrl) {
16181622
} else {
16191623
for (uint j = 0; j < m->req(); j++) {
16201624
Node* in = m->in(j);
1621-
if (in == NULL) {
1622-
continue;
1625+
if (in != NULL) {
1626+
wq.push(in);
16231627
}
1624-
wq.push(in);
16251628
}
16261629
}
16271630
if (c != NULL) {
1628-
assert(is_dominator(c, n_ctrl), "");
1629-
if (early_ctrl == NULL) {
1630-
early_ctrl = c;
1631-
} else if (is_dominator(early_ctrl, c)) {
1631+
assert(is_dominator(c, n_ctrl), "control input must dominate current control");
1632+
if (early_ctrl == NULL || is_dominator(early_ctrl, c)) {
16321633
early_ctrl = c;
16331634
}
16341635
}

0 commit comments

Comments
 (0)