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
39 changes: 38 additions & 1 deletion src/coreclr/jit/morphblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,32 @@ GenTree* MorphCopyBlockHelper::CopyFieldByField()
addrSpillStore->SetMorphed(m_comp);
}

auto postOrderAssertionProp = [=](GenTree* tree) {
Comment thread
AndyAyersMS marked this conversation as resolved.
if (m_comp->fgGlobalMorph && m_comp->optLocalAssertionProp && (m_comp->optAssertionCount > 0))
{
GenTree* optimizedTree = tree;
bool again = JitConfig.JitEnablePostorderLocalAssertionProp() > 0;
bool didOptimize = false;

while (again)
{
tree = optimizedTree;
optimizedTree = m_comp->optAssertionProp(m_comp->apLocalPostorder, tree, nullptr, nullptr);
again = (optimizedTree != nullptr);
didOptimize |= again;
}

assert(tree != nullptr);

if (didOptimize)
{
m_comp->gtUpdateNodeSideEffects(tree);
}
}

return tree;
};

auto grabAddr = [=, &result](unsigned offs) {
Comment thread
AndyAyersMS marked this conversation as resolved.
GenTree* addrClone = nullptr;
// Need address of the source.
Expand Down Expand Up @@ -1316,6 +1342,8 @@ GenTree* MorphCopyBlockHelper::CopyFieldByField()
}
}
assert(srcFld != nullptr);

srcFld = postOrderAssertionProp(srcFld);
srcFld->SetMorphed(m_comp);

GenTree* dstFldStore;
Expand Down Expand Up @@ -1372,7 +1400,16 @@ GenTree* MorphCopyBlockHelper::CopyFieldByField()
}
}
}
noway_assert(dstFldStore->TypeGet() == srcFld->TypeGet());

// Allow mismatched types only when srcFld is an integer constant
//
if (dstFldStore->TypeGet() != srcFld->TypeGet())
Comment thread
AndyAyersMS marked this conversation as resolved.
{
noway_assert(genActualType(dstFldStore->TypeGet()) == genActualType(srcFld->TypeGet()));
assert(srcFld->IsIntegralConst());
}

dstFldStore = postOrderAssertionProp(dstFldStore);
dstFldStore->SetMorphed(m_comp);

if (m_comp->optLocalAssertionProp)
Expand Down
Loading