Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Match all 3 sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams committed Jun 5, 2019
1 parent a9ea4f1 commit f100c7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/jit/copyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,11 @@ void Compiler::optCopyPropFoldCopyBlks(BasicBlock* block)
prevDst = prevDst->AsIndir()->Addr()->gtGetOp1();
}

GenTreeLclVarCommon* prevSrcLclVar = nullptr;
GenTreeLclVarCommon* prevDstLclVar = nullptr;
if (prevDst->OperGet() == GT_LCL_VAR || prevDst->OperGet() == GT_LCL_FLD)
{
prevSrcLclVar = &prevSrc->gtLclVarCommon;
prevDstLclVar = &prevDst->gtLclVarCommon;
}
else
Expand All @@ -508,6 +510,7 @@ void Compiler::optCopyPropFoldCopyBlks(BasicBlock* block)

assert(currSrcLclVar != nullptr);
assert(currDstLclVar != nullptr);
assert(prevSrcLclVar != nullptr);
assert(prevDstLclVar != nullptr);

if (prevDstLclVar->gtLclNum != currSrcLclVar->gtLclNum)
Expand All @@ -519,7 +522,8 @@ void Compiler::optCopyPropFoldCopyBlks(BasicBlock* block)
unsigned lclNum = prevDstLclVar->gtLclNum;
unsigned newLclNum = currDstLclVar->gtLclNum;

if (lvaLclSize(lclNum) != lvaLclSize(newLclNum))
if (lvaLclExactSize(lclNum) != lvaLclExactSize(prevSrcLclVar->gtLclNum) ||
lvaLclExactSize(newLclNum) != lvaLclExactSize(currSrcLclVar->gtLclNum))
{
// Don't propergate if they aren't the same size
continue;
Expand Down Expand Up @@ -763,7 +767,7 @@ void Compiler::optCopyPropThroughCopyBlk(BasicBlock* block)
unsigned lclNum = nextLclVar->gtLclNum;
unsigned newLclNum = currSrcLclVar->gtLclNum;

if (lvaLclSize(lclNum) != lvaLclSize(newLclNum))
if (lvaLclExactSize(lclNum) != lvaLclExactSize(newLclNum))
{
// Don't propergate if they aren't the same size
continue;
Expand Down

0 comments on commit f100c7d

Please sign in to comment.