Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a736381

Browse files
mikednAndyAyersMS
authored andcommitted
Give a proper VN to GT_BOX (#15666)
GT_BOX doesn't do anything so it should just get the VN of its sole operand. This allows assertion prop to see that the result of BOX is not null (since the BOX operand is the result of an object allocation which is never null).
1 parent 0bb37fd commit a736381

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/jit/valuenum.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7046,6 +7046,13 @@ void Compiler::fgValueNumberTree(GenTreePtr tree, bool evalAsgLhsInd)
70467046
tree->gtVNPair.SetBoth(ValueNumStore::NoVN);
70477047
break;
70487048

7049+
case GT_BOX:
7050+
// BOX doesn't do anything at this point, the actual object allocation
7051+
// and initialization happens separately (and not numbering BOX correctly
7052+
// prevents seeing allocation related assertions through it)
7053+
tree->gtVNPair = tree->gtGetOp1()->gtVNPair;
7054+
break;
7055+
70497056
default:
70507057
// The default action is to give the node a new, unique VN.
70517058
tree->gtVNPair.SetBoth(vnStore->VNForExpr(compCurBB, tree->TypeGet()));

0 commit comments

Comments
 (0)