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

Commit 43e5f18

Browse files
committed
Rewrite gtIsVtableAccess to avoid assert
Calling `HasIndex` from `gtIsVtableAccess` can leads to asserts as the underly code checks to see if the addressing sub-expressions are contained. But earlyProp runs early enough that it is not concerned with containment. The code just needs to verify that there is a ref type base and no index. Rework the code to do the checks directly.
1 parent f1b03b6 commit 43e5f18

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/jit/earlyprop.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ bool Compiler::gtIsVtableRef(GenTreePtr tree)
4343
{
4444
if (tree->OperGet() == GT_IND)
4545
{
46-
GenTreeIndir* indir = tree->AsIndir();
46+
GenTree* addr = tree->AsIndir()->Addr();
4747

48-
if (!indir->HasIndex())
48+
if (addr->OperIsAddrMode())
4949
{
50-
// Check if the base is an reference pointer.
51-
if (indir->Base()->TypeGet() == TYP_REF)
52-
{
53-
return true;
54-
}
50+
GenTreeAddrMode* addrMode = addr->AsAddrMode();
51+
52+
return (!addrMode->HasIndex() &&
53+
(addrMode->Base()->TypeGet() == TYP_REF));
5554
}
5655
}
5756

0 commit comments

Comments
 (0)