Skip to content
Merged
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
14 changes: 13 additions & 1 deletion src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10615,7 +10615,19 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
// The normal VN for base address is used to create the NullPtrExc
ValueNumPair vnpBaseNorm = vnStore->VNPNormalPair(baseVNP);

ValueNumPair excChkSet = vnStore->VNPExcSetSingleton(vnStore->VNPairForFunc(TYP_REF, VNF_NullPtrExc, vnpBaseNorm));
ValueNumPair excChkSet = vnStore->VNPForEmptyExcSet();

if (!vnStore->IsKnownNonNull(vnpBaseNorm.GetLiberal()))
{
excChkSet.SetLiberal(
vnStore->VNExcSetSingleton(vnStore->VNForFunc(TYP_REF, VNF_NullPtrExc, vnpBaseNorm.GetLiberal())));
}

if (!vnStore->IsKnownNonNull(vnpBaseNorm.GetConservative()))
{
excChkSet.SetConservative(
vnStore->VNExcSetSingleton(vnStore->VNForFunc(TYP_REF, VNF_NullPtrExc, vnpBaseNorm.GetConservative())));
}

// Add the NullPtrExc to "tree"'s value numbers.
tree->gtVNPair = vnStore->VNPWithExc(tree->gtVNPair, excChkSet);
Expand Down