Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Copy propagate on LCL_FLDs
A small and simple CQ improvement.

As usual, needed for future changes.
  • Loading branch information
SingleAccretion committed May 10, 2022
commit 5f14db0f30960391c6d4738d1fa4e4c6b032816d
20 changes: 11 additions & 9 deletions src/coreclr/jit/copyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,18 @@ void Compiler::optCopyProp(Statement* stmt, GenTreeLclVarCommon* tree, unsigned
continue;
}

var_types newLclType = newLclVarDsc->TypeGet();
if (!newLclVarDsc->lvNormalizeOnLoad())
if (tree->OperIs(GT_LCL_VAR))
{
newLclType = genActualType(newLclType);
}
var_types newLclType = newLclVarDsc->TypeGet();
if (!newLclVarDsc->lvNormalizeOnLoad())
{
newLclType = genActualType(newLclType);
}

if (newLclType != tree->TypeGet())
{
continue;
if (newLclType != tree->TypeGet())
{
continue;
}
}

#ifdef DEBUG
Expand Down Expand Up @@ -388,8 +391,7 @@ void Compiler::optBlockCopyProp(BasicBlock* block, LclNumToLiveDefsMap* curSsaNa

optCopyPropPushDef(tree, lclDefNode, lclNum, curSsaName);
}
// TODO-CQ: propagate on LCL_FLDs too.
else if (tree->OperIs(GT_LCL_VAR) && ((tree->gtFlags & GTF_VAR_DEF) == 0))
else if (tree->OperIs(GT_LCL_VAR, GT_LCL_FLD) && ((tree->gtFlags & GTF_VAR_DEF) == 0))
{
const unsigned lclNum = optIsSsaLocal(tree->AsLclVarCommon());

Expand Down