@@ -221,7 +221,7 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
221221 // fgGetStubAddrArg cannot handle complex trees (it calls gtClone)
222222 //
223223 bool isCallTarget = false ;
224- if (parent->IsCall ())
224+ if ((parent != nullptr ) && parent->IsCall ())
225225 {
226226 GenTreeCall* const parentCall = parent->AsCall ();
227227 isCallTarget = (parentCall->gtCallType == CT_INDIRECT) && (parentCall->gtCallAddr == node);
@@ -319,7 +319,7 @@ class ForwardSubVisitor final : public GenTreeVisitor<ForwardSubVisitor>
319319
320320 bool IsCallArg () const
321321 {
322- return m_parentNode->IsCall ();
322+ return (m_parentNode != nullptr ) && m_parentNode->IsCall ();
323323 }
324324
325325 unsigned GetComplexity () const
@@ -749,7 +749,7 @@ bool Compiler::fgForwardSubStatement(Statement* stmt)
749749 if (fsv.IsCallArg () && fsv.GetNode ()->TypeIs (TYP_STRUCT) &&
750750 !fwdSubNode->OperIs (GT_BLK, GT_LCL_VAR, GT_LCL_FLD, GT_MKREFANY))
751751 {
752- JITDUMP (" use is a struct arg; fwd sub node is not OBJ /LCL_VAR/LCL_FLD/MKREFANY\n " );
752+ JITDUMP (" use is a struct arg; fwd sub node is not BLK /LCL_VAR/LCL_FLD/MKREFANY\n " );
753753 return false ;
754754 }
755755
@@ -772,7 +772,7 @@ bool Compiler::fgForwardSubStatement(Statement* stmt)
772772 {
773773 GenTree* const parentNode = fsv.GetParentNode ();
774774
775- if (!parentNode->OperIs (GT_STORE_LCL_VAR))
775+ if ((parentNode == nullptr ) || !parentNode->OperIs (GT_STORE_LCL_VAR))
776776 {
777777 JITDUMP (" multi-reg struct node, parent not STORE_LCL_VAR\n " );
778778 return false ;
@@ -794,7 +794,8 @@ bool Compiler::fgForwardSubStatement(Statement* stmt)
794794 // for them on all 32 bit targets is a CQ regression due to some bad
795795 // interaction between decomposition and RA.
796796 //
797- if (compMethodReturnsMultiRegRetType () && fsv.GetParentNode ()->OperIs (GT_RETURN))
797+ if (compMethodReturnsMultiRegRetType () && (fsv.GetParentNode () != nullptr ) &&
798+ fsv.GetParentNode ()->OperIs (GT_RETURN))
798799 {
799800#if defined(TARGET_X86)
800801 if (fwdSubNode->TypeGet () == TYP_LONG)
0 commit comments