Skip to content

Commit c9175cc

Browse files
Fix ObjectAllocator assert (#79813)
1 parent 781fe41 commit c9175cc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/coreclr/jit/objectalloc.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,7 @@ void ObjectAllocator::RewriteUses()
839839
Compiler::fgWalkResult PreOrderVisit(GenTree** use, GenTree* user)
840840
{
841841
GenTree* tree = *use;
842-
assert(tree != nullptr);
843-
assert(tree->IsLocal());
842+
assert(tree->IsLocal() || tree->OperIsLocalAddr());
844843

845844
const unsigned int lclNum = tree->AsLclVarCommon()->GetLclNum();
846845
unsigned int newLclNum = BAD_VAR_NUM;
@@ -849,6 +848,9 @@ void ObjectAllocator::RewriteUses()
849848
if ((lclNum < BitVecTraits::GetSize(&m_allocator->m_bitVecTraits)) &&
850849
m_allocator->MayLclVarPointToStack(lclNum))
851850
{
851+
// Analysis does not handle indirect access to pointer locals.
852+
assert(tree->OperIs(GT_LCL_VAR));
853+
852854
var_types newType;
853855
if (m_allocator->m_HeapLocalToStackLocalMap.TryGetValue(lclNum, &newLclNum))
854856
{

0 commit comments

Comments
 (0)