Skip to content

Commit a552f20

Browse files
Add asserts
1 parent 654c062 commit a552f20

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/coreclr/jit/copyprop.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ void Compiler::optCopyPropPushDef(GenTreeOp* asg,
294294
if ((gsShadowVarInfo != nullptr) && lvaGetDesc(lclNum)->lvIsParam &&
295295
(gsShadowVarInfo[lclNum].shadowCopy != BAD_VAR_NUM))
296296
{
297+
assert(!curSsaName->Lookup(lclNum));
297298
return;
298299
}
299300

@@ -308,9 +309,11 @@ void Compiler::optCopyPropPushDef(GenTreeOp* asg,
308309
else
309310
{
310311
assert((lclNode->gtFlags & GTF_VAR_DEF) != 0);
312+
ssaDefNum = GetSsaNumForLocalVarDef(lclNode);
313+
311314
// This will be "RESERVED_SSA_NUM" for promoted struct fields assigned using the parent struct.
312315
// TODO-CQ: fix this.
313-
ssaDefNum = GetSsaNumForLocalVarDef(lclNode);
316+
assert((ssaDefNum != SsaConfig::RESERVED_SSA_NUM) || lvaGetDesc(lclNode)->CanBeReplacedWithItsField(this));
314317
}
315318

316319
// The default is "not available".

0 commit comments

Comments
 (0)