From 27ed1a311ec34e24afae6cc43d2c71e2620eb0ef Mon Sep 17 00:00:00 2001 From: Francisco Ferrari Bihurriet Date: Tue, 12 Aug 2025 05:10:28 +0200 Subject: [PATCH] Apply code review suggestions and add JBS to test --- src/hotspot/share/opto/subnode.cpp | 16 ++++++++-------- src/hotspot/share/opto/subnode.hpp | 2 +- .../jtreg/compiler/c2/gvn/TestBoolNodeGVN.java | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hotspot/share/opto/subnode.cpp b/src/hotspot/share/opto/subnode.cpp index 2c18ab374b1..798d9ce9881 100644 --- a/src/hotspot/share/opto/subnode.cpp +++ b/src/hotspot/share/opto/subnode.cpp @@ -852,22 +852,22 @@ const Type *CmpUNode::sub( const Type *t1, const Type *t2 ) const { // // (1a) and (1b) is covered by this method since we can directly return the corresponding TypeInt::CC_* // while (2) is covered in BoolNode::Ideal since we create a new non-constant node (see [CMPU_MASK]). -const Type* CmpUNode::Value_cmpu_and_mask(PhaseValues* phase, const Node* in1, const Node* in2) { - if (in1->Opcode() == Op_AndI) { +const Type* CmpUNode::Value_cmpu_and_mask(PhaseValues* phase, const Node* andI, const Node* rhs) { + if (andI->Opcode() == Op_AndI) { // (1a) "(x & m) <=u m" and "(m & x) <=u m" are always true, // so CmpU(x & m, m) and CmpU(m & x, m) are known to be LE. - const Node* rhs_m = in2; - if (in1->in(2) == rhs_m || in1->in(1) == rhs_m) { + const Node* rhs_m = rhs; + if (andI->in(2) == rhs_m || andI->in(1) == rhs_m) { return TypeInt::CC_LE; } // (1b) "(x & m) Opcode() == Op_AddI && in2->in(2)->find_int_con(0) == 1) { - rhs_m = in2->in(1); + if (rhs->Opcode() == Op_AddI && rhs->in(2)->find_int_con(0) == 1) { + rhs_m = rhs->in(1); const TypeInt* rhs_m_type = phase->type(rhs_m)->isa_int(); // Exclude any case where m == -1 is possible. if (rhs_m_type != nullptr && (rhs_m_type->_lo > -1 || rhs_m_type->_hi < -1)) { - if (in1->in(2) == rhs_m || in1->in(1) == rhs_m) { + if (andI->in(2) == rhs_m || andI->in(1) == rhs_m) { return TypeInt::CC_LT; } } @@ -1896,7 +1896,7 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Simplify a Bool (convert condition codes to boolean (1 or 0)) node, // based on local information. If the input is constant, do it. const Type* BoolNode::Value(PhaseGVN* phase) const { - return _test.cc2logical( phase->type( in(1) ) ); + return _test.cc2logical(phase->type(in(1))); } #ifndef PRODUCT diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index 07e59c1051b..30599264fcc 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -171,7 +171,7 @@ public: //------------------------------CmpUNode--------------------------------------- // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1). class CmpUNode : public CmpNode { - static const Type* Value_cmpu_and_mask(PhaseValues*, const Node*, const Node*); + static const Type* Value_cmpu_and_mask(PhaseValues* phase, const Node* andI, const Node* rhs); public: CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} virtual int Opcode() const; diff --git a/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java b/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java index 384dc6f8f11..85cfd706ecb 100644 --- a/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java +++ b/test/hotspot/jtreg/compiler/c2/gvn/TestBoolNodeGVN.java @@ -29,7 +29,7 @@ import java.util.Random; /** * @test - * @bug 8327381 + * @bug 8327381 8364970 * @summary Refactor boolean node tautology transformations * @library /test/lib / * @run driver compiler.c2.gvn.TestBoolNodeGVN