Skip to content

Commit 24936b9

Browse files
committed
8364409: [BACKOUT] Consolidate Identity of self-inverse operations
Reviewed-by: chagedorn, bmaillard Backport-of: ddb64836e5bafededb705329137e353f8c74dd5d
1 parent b5bec8d commit 24936b9

File tree

4 files changed

+20
-237
lines changed

4 files changed

+20
-237
lines changed

src/hotspot/share/opto/subnode.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,9 +2074,15 @@ const Type* ReverseLNode::Value(PhaseGVN* phase) const {
20742074
return bottom_type();
20752075
}
20762076

2077-
Node* InvolutionNode::Identity(PhaseGVN* phase) {
2078-
// Op ( Op x ) => x
2079-
if (in(1)->Opcode() == Opcode()) {
2077+
Node* ReverseINode::Identity(PhaseGVN* phase) {
2078+
if (in(1)->Opcode() == Op_ReverseI) {
2079+
return in(1)->in(1);
2080+
}
2081+
return this;
2082+
}
2083+
2084+
Node* ReverseLNode::Identity(PhaseGVN* phase) {
2085+
if (in(1)->Opcode() == Op_ReverseL) {
20802086
return in(1)->in(1);
20812087
}
20822088
return this;

src/hotspot/share/opto/subnode.hpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -439,18 +439,11 @@ class CmpLTMaskNode : public Node {
439439
virtual uint ideal_reg() const { return Op_RegI; }
440440
};
441441

442-
//------------------------------InvolutionNode----------------------------------
443-
// Represents a self-inverse operation, i.e., op(op(x)) = x for any x
444-
class InvolutionNode : public Node {
445-
public:
446-
InvolutionNode(Node* in) : Node(nullptr, in) {}
447-
virtual Node* Identity(PhaseGVN* phase);
448-
};
449442

450443
//------------------------------NegNode----------------------------------------
451-
class NegNode : public InvolutionNode {
444+
class NegNode : public Node {
452445
public:
453-
NegNode(Node* in1) : InvolutionNode(in1) {
446+
NegNode(Node* in1) : Node(nullptr, in1) {
454447
init_class_id(Class_Neg);
455448
}
456449
};
@@ -562,18 +555,16 @@ class SqrtHFNode : public Node {
562555
};
563556

564557

565-
class ReverseBytesNode : public InvolutionNode {
558+
class ReverseBytesNode : public Node {
566559
public:
567-
ReverseBytesNode(Node* in) : InvolutionNode(in) {}
560+
ReverseBytesNode(Node* in) : Node(nullptr, in) {}
568561
virtual const Type* Value(PhaseGVN* phase) const;
569562
};
570563
//-------------------------------ReverseBytesINode--------------------------------
571564
// reverse bytes of an integer
572565
class ReverseBytesINode : public ReverseBytesNode {
573566
public:
574-
ReverseBytesINode(Node* in) : ReverseBytesNode(in) {
575-
}
576-
567+
ReverseBytesINode(Node* in) : ReverseBytesNode(in) {}
577568
virtual int Opcode() const;
578569
const Type* bottom_type() const { return TypeInt::INT; }
579570
virtual uint ideal_reg() const { return Op_RegI; }
@@ -611,23 +602,25 @@ class ReverseBytesSNode : public ReverseBytesNode {
611602

612603
//-------------------------------ReverseINode--------------------------------
613604
// reverse bits of an int
614-
class ReverseINode : public InvolutionNode {
605+
class ReverseINode : public Node {
615606
public:
616-
ReverseINode(Node* in) : InvolutionNode(in) {}
607+
ReverseINode(Node* in) : Node(nullptr,in) {}
617608
virtual int Opcode() const;
618609
const Type* bottom_type() const { return TypeInt::INT; }
619610
virtual uint ideal_reg() const { return Op_RegI; }
611+
virtual Node* Identity(PhaseGVN* phase);
620612
virtual const Type* Value(PhaseGVN* phase) const;
621613
};
622614

623615
//-------------------------------ReverseLNode--------------------------------
624616
// reverse bits of a long
625-
class ReverseLNode : public InvolutionNode {
617+
class ReverseLNode : public Node {
626618
public:
627-
ReverseLNode(Node* in) : InvolutionNode(in) {}
619+
ReverseLNode(Node* in) : Node(nullptr, in) {}
628620
virtual int Opcode() const;
629621
const Type* bottom_type() const { return TypeLong::LONG; }
630622
virtual uint ideal_reg() const { return Op_RegL; }
623+
virtual Node* Identity(PhaseGVN* phase);
631624
virtual const Type* Value(PhaseGVN* phase) const;
632625
};
633626

test/hotspot/jtreg/compiler/c2/irTests/InvolutionIdentityTests.java

Lines changed: 0 additions & 206 deletions
This file was deleted.

test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,16 +1469,6 @@ public class IRNode {
14691469
superWordNodes(MAX_REDUCTION_V, "MaxReductionV");
14701470
}
14711471

1472-
public static final String NEG_F = PREFIX + "NEG_F" + POSTFIX;
1473-
static {
1474-
beforeMatchingNameRegex(NEG_F, "NegF");
1475-
}
1476-
1477-
public static final String NEG_D = PREFIX + "NEG_D" + POSTFIX;
1478-
static {
1479-
beforeMatchingNameRegex(NEG_D, "NegD");
1480-
}
1481-
14821472
public static final String NEG_VF = VECTOR_PREFIX + "NEG_VF" + POSTFIX;
14831473
static {
14841474
vectorNode(NEG_VF, "NegVF", TYPE_FLOAT);

0 commit comments

Comments
 (0)