Skip to content

Commit b9d0075

Browse files
author
duke
committed
Automatic merge of jdk:master into master
2 parents 95e1ccc + 1580574 commit b9d0075

File tree

10 files changed

+123
-108
lines changed

10 files changed

+123
-108
lines changed

src/hotspot/share/adlc/output_c.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,10 +1150,9 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch
11501150
//
11511151
// Check for equivalence
11521152
//
1153-
// fprintf(fp, "phase->eqv( ");
1154-
// fprintf(fp, "inst%d->in(%d+%d) /* %s */, inst%d->in(%d+%d) /* %s */",
1155-
// left_index, left_op_base, left_op_index, left_op,
1156-
// right_index, right_op_base, right_op_index, right_op );
1153+
// fprintf(fp, "(inst%d->_opnds[%d]->reg(ra_,inst%d%s) /* %d.%s */ == /* %d.%s */ inst%d->_opnds[%d]->reg(ra_,inst%d%s)",
1154+
// left_index, left_op_index, left_index, left_reg_index, left_index, left_op
1155+
// right_index, right_op, right_index, right_op_index, right_index, right_reg_index);
11571156
// fprintf(fp, ")");
11581157
//
11591158
switch( left_interface_type ) {

src/hotspot/share/opto/addnode.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,9 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) {
328328
//------------------------------Identity---------------------------------------
329329
// Fold (x-y)+y OR y+(x-y) into x
330330
Node* AddINode::Identity(PhaseGVN* phase) {
331-
if( in(1)->Opcode() == Op_SubI && phase->eqv(in(1)->in(2),in(2)) ) {
331+
if (in(1)->Opcode() == Op_SubI && in(1)->in(2) == in(2)) {
332332
return in(1)->in(1);
333-
}
334-
else if( in(2)->Opcode() == Op_SubI && phase->eqv(in(2)->in(2),in(1)) ) {
333+
} else if (in(2)->Opcode() == Op_SubI && in(2)->in(2) == in(1)) {
335334
return in(2)->in(1);
336335
}
337336
return AddNode::Identity(phase);
@@ -445,10 +444,9 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
445444
//------------------------------Identity---------------------------------------
446445
// Fold (x-y)+y OR y+(x-y) into x
447446
Node* AddLNode::Identity(PhaseGVN* phase) {
448-
if( in(1)->Opcode() == Op_SubL && phase->eqv(in(1)->in(2),in(2)) ) {
447+
if (in(1)->Opcode() == Op_SubL && in(1)->in(2) == in(2)) {
449448
return in(1)->in(1);
450-
}
451-
else if( in(2)->Opcode() == Op_SubL && phase->eqv(in(2)->in(2),in(1)) ) {
449+
} else if (in(2)->Opcode() == Op_SubL && in(2)->in(2) == in(1)) {
452450
return in(2)->in(1);
453451
}
454452
return AddNode::Identity(phase);
@@ -736,7 +734,7 @@ uint AddPNode::match_edge(uint idx) const {
736734
//------------------------------Identity---------------------------------------
737735
Node* OrINode::Identity(PhaseGVN* phase) {
738736
// x | x => x
739-
if (phase->eqv(in(1), in(2))) {
737+
if (in(1) == in(2)) {
740738
return in(1);
741739
}
742740

@@ -823,7 +821,7 @@ const Type *OrINode::add_ring( const Type *t0, const Type *t1 ) const {
823821
//------------------------------Identity---------------------------------------
824822
Node* OrLNode::Identity(PhaseGVN* phase) {
825823
// x | x => x
826-
if (phase->eqv(in(1), in(2))) {
824+
if (in(1) == in(2)) {
827825
return in(1);
828826
}
829827

@@ -1078,15 +1076,15 @@ Node *MinINode::Ideal(PhaseGVN *phase, bool can_reshape) {
10781076

10791077
// Transform MIN2(x + c0, MIN2(x + c1, z)) into MIN2(x + MIN2(c0, c1), z)
10801078
// if x == y and the additions can't overflow.
1081-
if (phase->eqv(x,y) && tx != NULL &&
1079+
if (x == y && tx != NULL &&
10821080
!can_overflow(tx, x_off) &&
10831081
!can_overflow(tx, y_off)) {
10841082
return new MinINode(phase->transform(new AddINode(x, phase->intcon(MIN2(x_off, y_off)))), r->in(2));
10851083
}
10861084
} else {
10871085
// Transform MIN2(x + c0, y + c1) into x + MIN2(c0, c1)
10881086
// if x == y and the additions can't overflow.
1089-
if (phase->eqv(x,y) && tx != NULL &&
1087+
if (x == y && tx != NULL &&
10901088
!can_overflow(tx, x_off) &&
10911089
!can_overflow(tx, y_off)) {
10921090
return new AddINode(x,phase->intcon(MIN2(x_off,y_off)));

src/hotspot/share/opto/callnode.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,12 @@ Node* SafePointNode::Identity(PhaseGVN* phase) {
12241224

12251225
//------------------------------Value------------------------------------------
12261226
const Type* SafePointNode::Value(PhaseGVN* phase) const {
1227-
if( phase->type(in(0)) == Type::TOP ) return Type::TOP;
1228-
if( phase->eqv( in(0), this ) ) return Type::TOP; // Dead infinite loop
1227+
if (phase->type(in(0)) == Type::TOP) {
1228+
return Type::TOP;
1229+
}
1230+
if (in(0) == this) {
1231+
return Type::TOP; // Dead infinite loop
1232+
}
12291233
return Type::CONTROL;
12301234
}
12311235

src/hotspot/share/opto/cfgnode.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ bool RegionNode::is_possible_unsafe_loop(const PhaseGVN* phase) const {
344344
Node* n = raw_out(i);
345345
if (n != NULL && n->is_Phi()) {
346346
PhiNode* phi = n->as_Phi();
347-
assert(phase->eqv(phi->in(0), this), "sanity check phi");
347+
assert(phi->in(0) == this, "sanity check phi");
348348
if (phi->outcnt() == 0) {
349349
continue; // Safe case - no loops
350350
}
@@ -383,7 +383,7 @@ bool RegionNode::is_unreachable_from_root(const PhaseGVN* phase) const {
383383
for (uint i = 0; i < max; i++) {
384384
Node* m = n->raw_out(i);
385385
if (m != NULL && m->is_CFG()) {
386-
if (phase->eqv(m, this)) {
386+
if (m == this) {
387387
return false; // We reached the Region node - it is not dead.
388388
}
389389
if (!visited.test_set(m->_idx))
@@ -568,7 +568,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
568568
for (j = outs(); has_out(j); j++) {
569569
Node *n = out(j);
570570
if( n->is_Phi() ) {
571-
assert( igvn->eqv(n->in(0), this), "" );
571+
assert(n->in(0) == this, "");
572572
assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" );
573573
// Break dead loop data path.
574574
// Eagerly replace phis with top to avoid regionless phis.
@@ -619,7 +619,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
619619
// The fallthrough case since we already checked dead loops above.
620620
parent_ctrl = in(1);
621621
assert(parent_ctrl != NULL, "Region is a copy of some non-null control");
622-
assert(!igvn->eqv(parent_ctrl, this), "Close dead loop");
622+
assert(parent_ctrl != this, "Close dead loop");
623623
}
624624
if (!add_to_worklist)
625625
igvn->add_users_to_worklist(this); // Check for further allowed opts
@@ -641,7 +641,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
641641
igvn->replace_node(n, in);
642642
}
643643
else if( n->is_Region() ) { // Update all incoming edges
644-
assert( !igvn->eqv(n, this), "Must be removed from DefUse edges");
644+
assert(n != this, "Must be removed from DefUse edges");
645645
uint uses_found = 0;
646646
for( uint k=1; k < n->req(); k++ ) {
647647
if( n->in(k) == this ) {
@@ -654,12 +654,12 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
654654
}
655655
}
656656
else {
657-
assert( igvn->eqv(n->in(0), this), "Expect RegionNode to be control parent");
657+
assert(n->in(0) == this, "Expect RegionNode to be control parent");
658658
n->set_req(0, parent_ctrl);
659659
}
660660
#ifdef ASSERT
661661
for( uint k=0; k < n->req(); k++ ) {
662-
assert( !igvn->eqv(n->in(k), this), "All uses of RegionNode should be gone");
662+
assert(n->in(k) != this, "All uses of RegionNode should be gone");
663663
}
664664
#endif
665665
}
@@ -2078,7 +2078,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
20782078
if (can_reshape) {
20792079
opt = split_flow_path(phase, this);
20802080
// This optimization only modifies phi - don't need to check for dead loop.
2081-
assert(opt == NULL || phase->eqv(opt, this), "do not elide phi");
2081+
assert(opt == NULL || opt == this, "do not elide phi");
20822082
if (opt != NULL) return opt;
20832083
}
20842084

@@ -2194,7 +2194,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
21942194
if (ii->is_MergeMem()) {
21952195
MergeMemNode* n = ii->as_MergeMem();
21962196
merge_width = MAX2(merge_width, n->req());
2197-
saw_self = saw_self || phase->eqv(n->base_memory(), this);
2197+
saw_self = saw_self || (n->base_memory() == this);
21982198
}
21992199
}
22002200

src/hotspot/share/opto/divnode.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,9 @@ const Type* DivINode::Value(PhaseGVN* phase) const {
505505
if( t2 == Type::TOP ) return Type::TOP;
506506

507507
// x/x == 1 since we always generate the dynamic divisor check for 0.
508-
if( phase->eqv( in(1), in(2) ) )
508+
if (in(1) == in(2)) {
509509
return TypeInt::ONE;
510+
}
510511

511512
// Either input is BOTTOM ==> the result is the local BOTTOM
512513
const Type *bot = bottom_type();
@@ -610,8 +611,9 @@ const Type* DivLNode::Value(PhaseGVN* phase) const {
610611
if( t2 == Type::TOP ) return Type::TOP;
611612

612613
// x/x == 1 since we always generate the dynamic divisor check for 0.
613-
if( phase->eqv( in(1), in(2) ) )
614+
if (in(1) == in(2)) {
614615
return TypeLong::ONE;
616+
}
615617

616618
// Either input is BOTTOM ==> the result is the local BOTTOM
617619
const Type *bot = bottom_type();
@@ -685,9 +687,10 @@ const Type* DivFNode::Value(PhaseGVN* phase) const {
685687
// x/x == 1, we ignore 0/0.
686688
// Note: if t1 and t2 are zero then result is NaN (JVMS page 213)
687689
// Does not work for variables because of NaN's
688-
if( phase->eqv( in(1), in(2) ) && t1->base() == Type::FloatCon)
689-
if (!g_isnan(t1->getf()) && g_isfinite(t1->getf()) && t1->getf() != 0.0) // could be negative ZERO or NaN
690-
return TypeF::ONE;
690+
if (in(1) == in(2) && t1->base() == Type::FloatCon &&
691+
!g_isnan(t1->getf()) && g_isfinite(t1->getf()) && t1->getf() != 0.0) { // could be negative ZERO or NaN
692+
return TypeF::ONE;
693+
}
691694

692695
if( t2 == TypeF::ONE )
693696
return t1;
@@ -773,9 +776,10 @@ const Type* DivDNode::Value(PhaseGVN* phase) const {
773776
// x/x == 1, we ignore 0/0.
774777
// Note: if t1 and t2 are zero then result is NaN (JVMS page 213)
775778
// Does not work for variables because of NaN's
776-
if( phase->eqv( in(1), in(2) ) && t1->base() == Type::DoubleCon)
777-
if (!g_isnan(t1->getd()) && g_isfinite(t1->getd()) && t1->getd() != 0.0) // could be negative ZERO or NaN
778-
return TypeD::ONE;
779+
if (in(1) == in(2) && t1->base() == Type::DoubleCon &&
780+
!g_isnan(t1->getd()) && g_isfinite(t1->getd()) && t1->getd() != 0.0) { // could be negative ZERO or NaN
781+
return TypeD::ONE;
782+
}
779783

780784
if( t2 == TypeD::ONE )
781785
return t1;
@@ -990,7 +994,9 @@ const Type* ModINode::Value(PhaseGVN* phase) const {
990994
// 0 MOD X is 0
991995
if( t1 == TypeInt::ZERO ) return TypeInt::ZERO;
992996
// X MOD X is 0
993-
if( phase->eqv( in(1), in(2) ) ) return TypeInt::ZERO;
997+
if (in(1) == in(2)) {
998+
return TypeInt::ZERO;
999+
}
9941000

9951001
// Either input is BOTTOM ==> the result is the local BOTTOM
9961002
const Type *bot = bottom_type();
@@ -1163,7 +1169,9 @@ const Type* ModLNode::Value(PhaseGVN* phase) const {
11631169
// 0 MOD X is 0
11641170
if( t1 == TypeLong::ZERO ) return TypeLong::ZERO;
11651171
// X MOD X is 0
1166-
if( phase->eqv( in(1), in(2) ) ) return TypeLong::ZERO;
1172+
if (in(1) == in(2)) {
1173+
return TypeLong::ZERO;
1174+
}
11671175

11681176
// Either input is BOTTOM ==> the result is the local BOTTOM
11691177
const Type *bot = bottom_type();

src/hotspot/share/opto/memnode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
10741074

10751075
if (st->is_Store()) {
10761076
Node* st_adr = st->in(MemNode::Address);
1077-
if (!phase->eqv(st_adr, ld_adr)) {
1077+
if (st_adr != ld_adr) {
10781078
// Try harder before giving up. Unify base pointers with casts (e.g., raw/non-raw pointers).
10791079
intptr_t st_off = 0;
10801080
Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_off);
@@ -1523,7 +1523,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
15231523

15241524
// Do nothing here if Identity will find a value
15251525
// (to avoid infinite chain of value phis generation).
1526-
if (!phase->eqv(this, this->Identity(phase))) {
1526+
if (this != Identity(phase)) {
15271527
return NULL;
15281528
}
15291529

@@ -2737,7 +2737,7 @@ Node* StoreNode::Identity(PhaseGVN* phase) {
27372737
// Steps (a), (b): Walk past independent stores to find an exact match.
27382738
if (prev_mem != NULL) {
27392739
Node* prev_val = can_see_stored_value(prev_mem, phase);
2740-
if (prev_val != NULL && phase->eqv(prev_val, val)) {
2740+
if (prev_val != NULL && prev_val == val) {
27412741
// prev_val and val might differ by a cast; it would be good
27422742
// to keep the more informative of the two.
27432743
result = mem;

src/hotspot/share/opto/movenode.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Node *CMoveNode::Ideal(PhaseGVN *phase, bool can_reshape) {
7878
if( in(0) && remove_dead_region(phase, can_reshape) ) return this;
7979
// Don't bother trying to transform a dead node
8080
if( in(0) && in(0)->is_top() ) return NULL;
81-
assert( !phase->eqv(in(Condition), this) &&
82-
!phase->eqv(in(IfFalse), this) &&
83-
!phase->eqv(in(IfTrue), this), "dead loop in CMoveNode::Ideal" );
81+
assert(in(Condition) != this &&
82+
in(IfFalse) != this &&
83+
in(IfTrue) != this, "dead loop in CMoveNode::Ideal" );
8484
if( phase->type(in(Condition)) == Type::TOP )
8585
return NULL; // return NULL when Condition is dead
8686

@@ -98,11 +98,9 @@ Node *CMoveNode::Ideal(PhaseGVN *phase, bool can_reshape) {
9898
// Helper function to check for CMOVE identity. Shared with PhiNode::Identity
9999
Node *CMoveNode::is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ) {
100100
// Check for Cmp'ing and CMove'ing same values
101-
if( (phase->eqv(cmp->in(1),f) &&
102-
phase->eqv(cmp->in(2),t)) ||
103-
// Swapped Cmp is OK
104-
(phase->eqv(cmp->in(2),f) &&
105-
phase->eqv(cmp->in(1),t)) ) {
101+
if ((cmp->in(1) == f && cmp->in(2) == t) ||
102+
// Swapped Cmp is OK
103+
(cmp->in(2) == f && cmp->in(1) == t)) {
106104
// Give up this identity check for floating points because it may choose incorrect
107105
// value around 0.0 and -0.0
108106
if ( cmp->Opcode()==Op_CmpF || cmp->Opcode()==Op_CmpD )
@@ -122,12 +120,16 @@ Node *CMoveNode::is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f
122120
// Conditional-move is an identity if both inputs are the same, or the test
123121
// true or false.
124122
Node* CMoveNode::Identity(PhaseGVN* phase) {
125-
if( phase->eqv(in(IfFalse),in(IfTrue)) ) // C-moving identical inputs?
126-
return in(IfFalse); // Then it doesn't matter
127-
if( phase->type(in(Condition)) == TypeInt::ZERO )
128-
return in(IfFalse); // Always pick left(false) input
129-
if( phase->type(in(Condition)) == TypeInt::ONE )
130-
return in(IfTrue); // Always pick right(true) input
123+
// C-moving identical inputs?
124+
if (in(IfFalse) == in(IfTrue)) {
125+
return in(IfFalse); // Then it doesn't matter
126+
}
127+
if (phase->type(in(Condition)) == TypeInt::ZERO) {
128+
return in(IfFalse); // Always pick left(false) input
129+
}
130+
if (phase->type(in(Condition)) == TypeInt::ONE) {
131+
return in(IfTrue); // Always pick right(true) input
132+
}
131133

132134
// Check for CMove'ing a constant after comparing against the constant.
133135
// Happens all the time now, since if we compare equality vs a constant in

src/hotspot/share/opto/mulnode.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,13 @@ Node *MulNode::Ideal(PhaseGVN *phase, bool can_reshape) {
8787
Node *mul1 = in(1);
8888
#ifdef ASSERT
8989
// Check for dead loop
90-
int op1 = mul1->Opcode();
91-
if( phase->eqv( mul1, this ) || phase->eqv( in(2), this ) ||
92-
( ( op1 == mul_opcode() || op1 == add_opcode() ) &&
93-
( phase->eqv( mul1->in(1), this ) || phase->eqv( mul1->in(2), this ) ||
94-
phase->eqv( mul1->in(1), mul1 ) || phase->eqv( mul1->in(2), mul1 ) ) ) )
90+
int op1 = mul1->Opcode();
91+
if ((mul1 == this) || (in(2) == this) ||
92+
((op1 == mul_opcode() || op1 == add_opcode()) &&
93+
((mul1->in(1) == this) || (mul1->in(2) == this) ||
94+
(mul1->in(1) == mul1) || (mul1->in(2) == mul1)))) {
9595
assert(false, "dead loop in MulNode::Ideal");
96+
}
9697
#endif
9798

9899
if( mul1->Opcode() == mul_opcode() ) { // Left input is a multiply?
@@ -436,7 +437,9 @@ const Type *AndINode::mul_ring( const Type *t0, const Type *t1 ) const {
436437
Node* AndINode::Identity(PhaseGVN* phase) {
437438

438439
// x & x => x
439-
if (phase->eqv(in(1), in(2))) return in(1);
440+
if (in(1) == in(2)) {
441+
return in(1);
442+
}
440443

441444
Node* in1 = in(1);
442445
uint op = in1->Opcode();
@@ -558,7 +561,9 @@ const Type *AndLNode::mul_ring( const Type *t0, const Type *t1 ) const {
558561
Node* AndLNode::Identity(PhaseGVN* phase) {
559562

560563
// x & x => x
561-
if (phase->eqv(in(1), in(2))) return in(1);
564+
if (in(1) == in(2)) {
565+
return in(1);
566+
}
562567

563568
Node *usr = in(1);
564569
const TypeLong *t2 = phase->type( in(2) )->isa_long();

src/hotspot/share/opto/phaseX.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ class PhaseTransform : public Phase {
282282
// in a faster or cheaper fashion.
283283
virtual Node *transform( Node *n ) = 0;
284284

285-
// Return whether two Nodes are equivalent.
286-
// Must not be recursive, since the recursive version is built from this.
287-
// For pessimistic optimizations this is simply pointer equivalence.
288-
bool eqv(const Node* n1, const Node* n2) const { return n1 == n2; }
289-
290285
// For pessimistic passes, the return type must monotonically narrow.
291286
// For optimistic passes, the return type must monotonically widen.
292287
// It is possible to get into a "death march" in either type of pass,

0 commit comments

Comments
 (0)