@@ -287,7 +287,7 @@ private void constantPropagation(ref GlobalOptimizer go, block* thisblock, ref E
287287 listrds(go, IN ,t,null ,&rdl);
288288 if (! (config.flags & CFGnowarning)) // if warnings are enabled
289289 chkrd(t,rdl);
290- if (auto e = chkprop(go, t, rdl))
290+ if (auto e = chkprop(go.changes , t, rdl))
291291 { // Replace (t op= exp) with (t = e op exp)
292292
293293 e = el_copytree(e);
@@ -383,7 +383,7 @@ private void constantPropagation(ref GlobalOptimizer go, block* thisblock, ref E
383383
384384 if (! (config.flags & CFGnowarning)) // if warnings are enabled
385385 chkrd(n,rdl);
386- elem* e = chkprop(go, n, rdl);
386+ elem* e = chkprop(go.changes , n, rdl);
387387 if (e)
388388 { tym_t nty;
389389
@@ -494,13 +494,17 @@ private void chkrd(elem* n, Barray!(elem*) rdlist)
494494 * statics and globals. This could be fixed by adding dummy defs for
495495 * them before startblock, but we just kludge it and don't propagate
496496 * stuff for them.
497+ * Params:
498+ * changes = increment for each change to the tree
499+ * n = OPvar elem
500+ * rdlist = reaching definitions
497501 * Returns:
498502 * null do not propagate constant
499503 * e constant elem that we should replace n with
500504 */
501505
502506@trusted
503- private elem* chkprop (ref GlobalOptimizer go , elem* n, Barray! (elem* ) rdlist)
507+ private elem* chkprop (ref uint changes , elem* n, Barray! (elem* ) rdlist)
504508{
505509 elem* foundelem = null ;
506510 int unambig;
@@ -533,7 +537,7 @@ private elem* chkprop(ref GlobalOptimizer go, elem* n, Barray!(elem*) rdlist)
533537
534538 if (OTassign(d.Eoper)) // if assignment elem
535539 {
536- elem* t = d.E1 ;
540+ const elem* t = d.E1 ;
537541
538542 if (t.Eoper == OPvar)
539543 {
@@ -594,7 +598,7 @@ private elem* chkprop(ref GlobalOptimizer go, elem* n, Barray!(elem*) rdlist)
594598 WReqn(foundelem);
595599 printf(" ), %p to %p\n " ,foundelem,n);
596600 }
597- go.changes ++ ;
601+ ++ changes ;
598602 return foundelem;
599603 }
600604noprop:
0 commit comments