Skip to content
Closed
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
29 changes: 20 additions & 9 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8735,15 +8735,6 @@ void Compiler::fgValueNumberTree(GenTree* tree)
ValueNumPair op1VNPx;
vnStore->VNPUnpackExc(tree->AsOp()->gtOp1->gtVNPair, &op1VNP, &op1VNPx);

// If we are fetching the array length for an array ref that came from global memory
// then for CSE safety we must use the conservative value number for both
//
if (tree->OperIsArrLength() && ((tree->AsOp()->gtOp1->gtFlags & GTF_GLOB_REF) != 0))
{
// use the conservative value number for both when computing the VN for the ARR_LENGTH
op1VNP.SetBoth(op1VNP.GetConservative());
}

tree->gtVNPair =
vnStore->VNPWithExc(vnStore->VNPairForFunc(tree->TypeGet(), vnf, op1VNP), op1VNPx);
}
Expand Down Expand Up @@ -10421,6 +10412,26 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
vnStore->VNExcSetSingleton(vnStore->VNForFunc(TYP_REF, VNF_NullPtrExc, vnpBaseNorm.GetConservative())));
}

VNFuncApp func;
if (vnStore->GetVNFunc(vnpBaseNorm.GetConservative(), &func) &&
(func.m_func == VNF_GetsharedGcthreadstaticBaseNoctor))
{
switch (func.m_func)
{
case VNF_GetgenericsGcthreadstaticBase:
case VNF_GetgenericsNongcthreadstaticBase:
case VNF_GetsharedGcthreadstaticBase:
case VNF_GetsharedNongcthreadstaticBase:
case VNF_GetsharedGcthreadstaticBaseNoctor:
case VNF_GetsharedNongcthreadstaticBaseNoctor:
case VNF_GetsharedGcthreadstaticBaseDynamicclass:
case VNF_GetsharedNongcthreadstaticBaseDynamicclass:
tree->gtVNPair.SetConservative(tree->gtVNPair.GetLiberal());
break;
default:
break;
}
}
// Add the NullPtrExc to "tree"'s value numbers.
tree->gtVNPair = vnStore->VNPWithExc(tree->gtVNPair, excChkSet);
}
Expand Down