8374969: Incorrect results of LoadStoreNode::adr_type and SCMemProj::adr_type

Reviewed-by: roland, mhaessig
This commit is contained in:
Quan Anh Mai 2026-01-13 12:42:25 +00:00
parent 543a972222
commit a90c7eee6f
2 changed files with 10 additions and 8 deletions

View File

@ -3913,7 +3913,6 @@ const Type* SCMemProjNode::Value(PhaseGVN* phase) const
LoadStoreNode::LoadStoreNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* rt, uint required )
: Node(required),
_type(rt),
_adr_type(at),
_barrier_data(0)
{
init_req(MemNode::Control, c );
@ -3921,6 +3920,7 @@ LoadStoreNode::LoadStoreNode( Node *c, Node *mem, Node *adr, Node *val, const Ty
init_req(MemNode::Address, adr);
init_req(MemNode::ValueIn, val);
init_class_id(Class_LoadStore);
DEBUG_ONLY(_adr_type = at; adr_type();)
}
//------------------------------Value-----------------------------------------
@ -3944,6 +3944,11 @@ const Type* LoadStoreNode::Value(PhaseGVN* phase) const {
return bottom_type();
}
const TypePtr* LoadStoreNode::adr_type() const {
const TypePtr* cross_check = DEBUG_ONLY(_adr_type) NOT_DEBUG(nullptr);
return MemNode::calculate_adr_type(in(MemNode::Address)->bottom_type(), cross_check);
}
uint LoadStoreNode::ideal_reg() const {
return _type->ideal_reg();
}

View File

@ -797,11 +797,6 @@ public:
virtual int Opcode() const;
virtual bool is_CFG() const { return false; }
virtual const Type *bottom_type() const {return Type::MEMORY;}
virtual const TypePtr *adr_type() const {
Node* ctrl = in(0);
if (ctrl == nullptr) return nullptr; // node is dead
return ctrl->in(MemNode::Memory)->adr_type();
}
virtual uint ideal_reg() const { return 0;} // memory projections don't have a register
virtual const Type* Value(PhaseGVN* phase) const;
#ifndef PRODUCT
@ -814,9 +809,11 @@ public:
class LoadStoreNode : public Node {
private:
const Type* const _type; // What kind of value is loaded?
const TypePtr* _adr_type; // What kind of memory is being addressed?
uint8_t _barrier_data; // Bit field with barrier information
virtual uint size_of() const; // Size is bigger
#ifdef ASSERT
const TypePtr* _adr_type; // What kind of memory is being addressed?
#endif // ASSERT
public:
LoadStoreNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* rt, uint required );
virtual bool depends_only_on_test() const { return false; }
@ -824,7 +821,7 @@ public:
virtual const Type *bottom_type() const { return _type; }
virtual uint ideal_reg() const;
virtual const class TypePtr *adr_type() const { return _adr_type; } // returns bottom_type of address
virtual const TypePtr* adr_type() const;
virtual const Type* Value(PhaseGVN* phase) const;
bool result_not_used() const;