Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/coreclr/jit/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ void AsyncTransformation::CreateSuspension(BasicBlock* call
CreateAllocContinuationCall(subLayout.NeedsKeepAlive(), returnedContinuation, layout);

m_compiler->compCurBB = suspendBB;
m_compiler->fgMorphTree(allocContinuation);
m_compiler->fgMorphArgs(allocContinuation);

LIR::AsRange(suspendBB).InsertAtEnd(LIR::SeqTree(m_compiler, allocContinuation));

Expand Down Expand Up @@ -2057,7 +2057,7 @@ void AsyncTransformation::FinishContextHandlingOnSuspension(BasicBlock*
captureCall->gtArgs.PushFront(m_compiler, NewCallArg::Primitive(contContextElementPlaceholder));

m_compiler->compCurBB = suspendBB;
m_compiler->fgMorphTree(captureCall);
m_compiler->fgMorphArgs(captureCall);

LIR::AsRange(suspendBB).InsertAtEnd(LIR::SeqTree(m_compiler, captureCall));

Expand Down Expand Up @@ -2099,7 +2099,7 @@ void AsyncTransformation::FinishContextHandlingOnSuspension(BasicBlock*
SetCallEntrypointForR2R(captureExecContext, m_compiler, m_asyncInfo->captureExecutionContextMethHnd);

m_compiler->compCurBB = suspendBB;
m_compiler->fgMorphTree(captureExecContext);
m_compiler->fgMorphArgs(captureExecContext);

GenTree* newContinuation = m_compiler->gtNewLclvNode(GetNewContinuationVar(), TYP_REF);
unsigned offset = OFFSETOF__CORINFO_Continuation__data + layout.ExecutionContextOffset;
Expand Down Expand Up @@ -2174,7 +2174,7 @@ void AsyncTransformation::FinishContextHandlingOnSuspensionWithHelper(BasicBlock
}

m_compiler->compCurBB = suspendBB;
m_compiler->fgMorphTree(finishCall);
m_compiler->fgMorphArgs(finishCall);

LIR::AsRange(suspendBB).InsertAtEnd(LIR::SeqTree(m_compiler, finishCall));

Expand Down Expand Up @@ -2320,7 +2320,7 @@ void AsyncTransformation::RestoreContexts(BasicBlock* block, GenTreeCall* call,
restoreCall->gtArgs.PushFront(m_compiler, NewCallArg::Primitive(resumedPlaceholder));

m_compiler->compCurBB = suspendBB;
m_compiler->fgMorphTree(restoreCall);
m_compiler->fgMorphArgs(restoreCall);

LIR::AsRange(suspendBB).InsertAtEnd(LIR::SeqTree(m_compiler, restoreCall));

Expand Down Expand Up @@ -2537,7 +2537,7 @@ void AsyncTransformation::RestoreFromDataOnResumption(const ContinuationLayout&
restoreCall->gtArgs.PushFront(m_compiler, NewCallArg::Primitive(valuePlaceholder));

m_compiler->compCurBB = resumeBB;
m_compiler->fgMorphTree(restoreCall);
m_compiler->fgMorphArgs(restoreCall);

LIR::AsRange(resumeBB).InsertAtEnd(LIR::SeqTree(m_compiler, restoreCall));

Expand Down Expand Up @@ -2691,7 +2691,7 @@ BasicBlock* AsyncTransformation::RethrowExceptionOnResumption(BasicBlock*
GenTreeCall* rethrowException = m_compiler->gtNewHelperCallNode(CORINFO_HELP_THROWEXACT, TYP_VOID, exception);

m_compiler->compCurBB = rethrowExceptionBB;
m_compiler->fgMorphTree(rethrowException);
m_compiler->fgMorphArgs(rethrowException);

LIR::AsRange(rethrowExceptionBB).InsertAtEnd(LIR::SeqTree(m_compiler, rethrowException));

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6829,7 +6829,6 @@ class Compiler
GenTree* fgMorphIndexAddr(GenTreeIndexAddr* tree);
GenTree* fgMorphExpandCast(GenTreeCast* tree);
GenTreeFieldList* fgMorphLclToFieldList(GenTreeLclVar* lcl);
GenTreeCall* fgMorphArgs(GenTreeCall* call);

void fgMakeOutgoingStructArgCopy(GenTreeCall* call, CallArg* arg);

Expand Down Expand Up @@ -6937,7 +6936,8 @@ class Compiler
GenTree* fgMorphReduceAddOps(GenTree* tree);

public:
GenTree* fgMorphTree(GenTree* tree, MorphAddrContext* mac = nullptr);
GenTreeCall* fgMorphArgs(GenTreeCall* call);
GenTree* fgMorphTree(GenTree* tree, MorphAddrContext* mac = nullptr);

private:
void fgAssertionGen(GenTree* tree);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/gschecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void Compiler::gsCopyIntoShadow(unsigned lclNum, unsigned shadowLclNum)
call->gtArgs.PushBack(this, NewCallArg::Primitive(src));

compCurBB = fgFirstBB; // Needed by some morphing
fgMorphTree(call);
fgMorphArgs(call);
compCurBB = nullptr;

// Insert the IR
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,7 @@ void Lowering::LowerCFGCall(GenTreeCall* call)
// 'this' arg clone is not inserted, so no need to use a placeholder for that.
resolve->gtArgs.PushFront(m_compiler, NewCallArg::Primitive(thisArgClone));

m_compiler->fgMorphTree(resolve);
m_compiler->fgMorphArgs(resolve);

LIR::Range resolveRange = LIR::SeqTree(m_compiler, resolve);
GenTree* resolveFirst = resolveRange.FirstNode();
Expand Down Expand Up @@ -3853,7 +3853,7 @@ void Lowering::LowerCFGCall(GenTreeCall* call)
NewCallArg::Primitive(targetPlaceholder).WellKnown(WellKnownArg::ValidateIndirectCallTarget);
validate->gtArgs.PushFront(m_compiler, newArg);

m_compiler->fgMorphTree(validate);
m_compiler->fgMorphArgs(validate);

LIR::Range validateRange = LIR::SeqTree(m_compiler, validate);
GenTree* validateFirst = validateRange.FirstNode();
Expand Down Expand Up @@ -6881,7 +6881,7 @@ void Lowering::InsertPInvokeMethodProlog()
noway_assert(varDsc->lvType == TYP_I_IMPL);

GenTree* store = m_compiler->gtNewStoreLclVarNode(lclNum, call);
m_compiler->fgMorphTree(store);
m_compiler->fgMorphArgs(call);
firstBlockRange.InsertBefore(insertionPoint, LIR::SeqTree(m_compiler, store));
DISPTREERANGE(firstBlockRange, store);

Expand Down Expand Up @@ -7035,13 +7035,13 @@ void Lowering::InsertPInvokeCallProlog(GenTreeCall* call)
const unsigned numStkArgBytes = call->gtArgs.OutgoingArgsStackSize();
GenTree* stackBytes = m_compiler->gtNewIconNode(numStkArgBytes, TYP_INT);
// Insert call to CORINFO_HELP_JIT_PINVOKE_BEGIN
GenTree* helperCall =
GenTreeCall* helperCall =
m_compiler->gtNewHelperCallNode(CORINFO_HELP_JIT_PINVOKE_BEGIN, TYP_VOID, frameAddr, stackBytes);
#else
GenTree* helperCall = m_compiler->gtNewHelperCallNode(CORINFO_HELP_JIT_PINVOKE_BEGIN, TYP_VOID, frameAddr);
GenTreeCall* helperCall = m_compiler->gtNewHelperCallNode(CORINFO_HELP_JIT_PINVOKE_BEGIN, TYP_VOID, frameAddr);
#endif

m_compiler->fgMorphTree(helperCall);
m_compiler->fgMorphArgs(helperCall);
BlockRange().InsertBefore(insertBefore, LIR::SeqTree(m_compiler, helperCall));
LowerNode(helperCall); // helper call is inserted before current node and should be lowered here.
return;
Expand Down Expand Up @@ -7190,7 +7190,7 @@ void Lowering::InsertPInvokeCallEpilog(GenTreeCall* call)
// Insert call to CORINFO_HELP_JIT_PINVOKE_END
GenTreeCall* helperCall = m_compiler->gtNewHelperCallNode(CORINFO_HELP_JIT_PINVOKE_END, TYP_VOID, frameAddr);

m_compiler->fgMorphTree(helperCall);
m_compiler->fgMorphArgs(helperCall);
BlockRange().InsertAfter(call, LIR::SeqTree(m_compiler, helperCall));
ContainCheckCallOperands(helperCall);
return;
Expand Down Expand Up @@ -10218,7 +10218,7 @@ bool Lowering::TryLowerBlockStoreAsGcBulkCopyCall(GenTreeBlk* blk)
GenTreeIntCon* size = m_compiler->gtNewIconNode((ssize_t)blk->GetLayout()->GetSize(), TYP_I_IMPL);
BlockRange().InsertBefore(data, size);

// A hacky way to safely call fgMorphTree in Lower
// Use placeholders for the actual nodes so we can safely call fgMorphArgs in Lower
GenTree* destPlaceholder = m_compiler->gtNewZeroConNode(dest->TypeGet());
GenTree* dataPlaceholder = m_compiler->gtNewZeroConNode(genActualType(data));
GenTree* sizePlaceholder = m_compiler->gtNewZeroConNode(genActualType(size));
Expand Down Expand Up @@ -10341,7 +10341,7 @@ void Lowering::LowerBlockStoreAsHelperCall(GenTreeBlk* blkNode)
size = m_compiler->gtNewIconNode(blkNode->Size(), TYP_I_IMPL);
BlockRange().InsertBefore(data, size);

// A hacky way to safely call fgMorphTree in Lower
// Use placeholders for the actual nodes so we can safely call fgMorphArgs in Lower
GenTree* destPlaceholder = m_compiler->gtNewZeroConNode(dest->TypeGet());
GenTree* dataPlaceholder = m_compiler->gtNewZeroConNode(genActualType(data));
GenTree* sizePlaceholder = m_compiler->gtNewZeroConNode(genActualType(size));
Expand Down
Loading