Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,20 @@ ValueNumPair ValueNumStore::VNPWithExc(ValueNumPair vnp, ValueNumPair excSetVNP)

bool ValueNumStore::IsKnownNonNull(ValueNum vn)
{
if (vn == NoVN)
{
return false;
}

assert((TypeOfVN(vn) == TYP_I_IMPL) || (TypeOfVN(vn) == TYP_REF) || (TypeOfVN(vn) == TYP_BYREF));

target_ssize_t offset;
PeelOffsets(&vn, &offset);
if ((offset < 0) || m_compiler->fgIsBigOffset(static_cast<size_t>(offset)))
{
return false;
}

auto vnVisitor = [this](ValueNum vn) -> VNVisit {
if (vn != NoVN)
{
Expand All @@ -1623,8 +1637,8 @@ bool ValueNumStore::IsKnownNonNull(ValueNum vn)
return VNVisit::Continue;
}

VNFuncApp funcAttr;
if (GetVNFunc(vn, &funcAttr) && ((s_vnfOpAttribs[funcAttr.GetFunc()] & VNFOA_KnownNonNull) != 0))
VNFuncApp funcApp;
if (GetVNFunc(vn, &funcApp) && ((s_vnfOpAttribs[funcApp.GetFunc()] & VNFOA_KnownNonNull) != 0))
{
return VNVisit::Continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/valuenumfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ValueNumFuncDef(BitCast, 2, false, false) // Args: 0: VN of the arg,
ValueNumFuncDef(ZeroObj, 1, false, false) // Args: 0: VN of the class handle.

ValueNumFuncDef(PtrToLoc, 2, false, true) // Pointer (byref) to a local variable. Args: VN's of: 0: local's number, 1: offset.
ValueNumFuncDef(PtrToArrElem, 4, false, false) // Pointer (byref) to an array element. Args: 0: array elem type eq class var_types value, VN's of: 1: array, 2: index, 3: offset.
ValueNumFuncDef(PtrToArrElem, 4, false, true) // Pointer (byref) to an array element. Args: 0: array elem type eq class var_types value, VN's of: 1: array, 2: index, 3: offset.
Comment thread
EgorBo marked this conversation as resolved.
ValueNumFuncDef(PtrToStatic, 3, false, true) // Pointer (byref) to a static variable (or possibly a field thereof, if the static variable is a struct).
// Args: 0: (VN of) the box's address if the static is "boxed",
// 1: (VN of) the field sequence,
Expand Down
Loading