Skip to content

Commit

Permalink
Fixes for propagating gtControlExpr->gtFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
briansull committed Feb 10, 2021
1 parent da5b50f commit a6a4606
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,12 @@ void Compiler::fgDebugCheckFlags(GenTree* tree)
chkFlags |= (call->gtCallAddr->gtFlags & GTF_SIDE_EFFECT);
}

if ((call->gtControlExpr != nullptr) && call->IsExpandedEarly() && call->IsVirtualVtable())
{
fgDebugCheckFlags(call->gtControlExpr);
chkFlags |= (call->gtControlExpr->gtFlags & GTF_SIDE_EFFECT);
}

if (call->IsUnmanaged() && (call->gtCallMoreFlags & GTF_CALL_M_UNMGD_THISCALL))
{
if (call->gtCallArgs->GetNode()->OperGet() == GT_NOP)
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9164,9 +9164,12 @@ GenTree* Compiler::fgMorphCall(GenTreeCall* call)
assert(call->gtControlExpr == nullptr); // We only call this method and assign gtControlExpr once
call->gtControlExpr = fgExpandVirtualVtableCallTarget(call);
}
// We have to morph and re-morph the control expr
// We always have to morph or re-morph the control expr
//
call->gtControlExpr = fgMorphTree(call->gtControlExpr);

// Propogate any gtFlags into the call
call->gtFlags |= call->gtControlExpr->gtFlags;
}

// Morph stelem.ref helper call to store a null value, into a store into an array without the helper.
Expand Down Expand Up @@ -9336,7 +9339,6 @@ GenTree* Compiler::fgExpandVirtualVtableCallTarget(GenTreeCall* call)
GenTree* vtab;
assert(VPTR_OFFS == 0); // We have to add this value to the thisPtr to get the methodTable
vtab = gtNewOperNode(GT_IND, TYP_I_IMPL, thisPtr);
// vtab->gtFlags |= GTF_IND_NONFAULTING; // This could fault if the Object ref is null
vtab->gtFlags |= GTF_IND_INVARIANT;

// Get the appropriate vtable chunk
Expand Down

0 comments on commit a6a4606

Please sign in to comment.