File tree 1 file changed +19
-2
lines changed 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ void Compiler::optCopyPropPushDef(GenTreeOp* asg,
312
312
{
313
313
assert ((lclNode->gtFlags & GTF_VAR_DEF) != 0 );
314
314
315
- // Quirk: do not collect defs from PHIs. Preserves previous behavior .
315
+ // TODO-CQ: design better heuristics for propagation and remove this condition .
316
316
if (!asg->IsPhiDefn ())
317
317
{
318
318
ssaDefNum = GetSsaNumForLocalVarDef (lclNode);
@@ -480,10 +480,27 @@ void Compiler::optVnCopyProp()
480
480
// TODO-Cleanup: Move this function from Compiler to this class.
481
481
m_compiler->optBlockCopyPropPopStacks (block, &m_curSsaName);
482
482
}
483
+
484
+ void PropagateCopies ()
485
+ {
486
+ WalkTree ();
487
+
488
+ #ifdef DEBUG
489
+ // Verify the definitions remaining are only those we pushed for parameters.
490
+ for (LclNumToLiveDefsMap::KeyIterator iter = m_curSsaName.Begin (); !iter.Equal (m_curSsaName.End ()); ++iter)
491
+ {
492
+ unsigned lclNum = iter.Get ();
493
+ assert (m_compiler->lvaGetDesc (lclNum)->lvIsParam || (lclNum == m_compiler->info .compThisArg ));
494
+
495
+ CopyPropSsaDefStack* defStack = iter.GetValue ();
496
+ assert (defStack->Height () == 1 );
497
+ }
498
+ #endif // DEBUG
499
+ }
483
500
};
484
501
485
502
CopyPropDomTreeVisitor visitor (this );
486
- visitor.WalkTree ();
503
+ visitor.PropagateCopies ();
487
504
488
505
// Tracked variable count increases after CopyProp, so don't keep a shorter array around.
489
506
// Destroy (release) the varset.
You can’t perform that action at this time.
0 commit comments