Skip to content
Merged
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
29 changes: 25 additions & 4 deletions src/coreclr/jit/morphblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class MorphInitBlockHelper
virtual void TrySpecialCases();
virtual void MorphStructCases();

void PropagateAssertions();
void PropagateBlockAssertions();
void PropagateExpansionAssertions();

virtual const char* GetHelperName() const
{
Expand Down Expand Up @@ -127,7 +128,7 @@ GenTree* MorphInitBlockHelper::Morph()

PrepareDst();
PrepareSrc();
PropagateAssertions();
PropagateBlockAssertions();
TrySpecialCases();

if (m_transformationDecision == BlockTransformation::Undefined)
Expand All @@ -150,6 +151,8 @@ GenTree* MorphInitBlockHelper::Morph()
}
}

PropagateExpansionAssertions();

assert(m_transformationDecision != BlockTransformation::Undefined);
assert(m_result != nullptr);

Expand Down Expand Up @@ -278,22 +281,40 @@ void MorphInitBlockHelper::PrepareDst()
}

//------------------------------------------------------------------------
// PropagateAssertions: propagate assertions based on the original tree
// PropagateBlockAssertions: propagate assertions based on the original tree
//
// Notes:
// Once the init or copy tree is morphed, assertion gen can no
// longer recognize what it means.
//
// So we generate assertions based on the original tree.
//
void MorphInitBlockHelper::PropagateAssertions()
void MorphInitBlockHelper::PropagateBlockAssertions()
{
if (m_comp->optLocalAssertionProp)
{
m_comp->optAssertionGen(m_asg);
}
}

//------------------------------------------------------------------------
// PropagateExpansionAssertions: propagate assertions based on the
// expanded tree
//
// Notes:
// After the copy/init is expanded, we may see additional expansions
// to generate.
//
void MorphInitBlockHelper::PropagateExpansionAssertions()
{
// Consider doing this for FieldByField as well
//
if (m_comp->optLocalAssertionProp && (m_transformationDecision == BlockTransformation::OneAsgBlock))
{
m_comp->optAssertionGen(m_asg);
}
}

//------------------------------------------------------------------------
// PrepareSrc: Transform the asg src to an appropriate form and initialize member fields
// with information about it.
Expand Down