On 09/20/2016 06:31 AM, Robin Dapp wrote:

I meant to do sth like

Index: tree-ssa-propagate.c
--- tree-ssa-propagate.c        (revision 240133)
+++ tree-ssa-propagate.c        (working copy)
@@ -1105,10 +1105,10 @@ substitute_and_fold_dom_walker::before_d
       /* Replace real uses in the statement.  */
       did_replace |= replace_uses_in (stmt, get_value_fn);

-      /* If we made a replacement, fold the statement.  */
-      if (did_replace)
+      /* Fold the statement.  */
+      if (fold_stmt (&i, follow_single_use_edges))
-         fold_stmt (&i, follow_single_use_edges);
+         did_replace = true;
          stmt = gsi_stmt (i);

this would need compile-time cost evaluation (and avoid the tree-vrp.c
folding part
of your patch).

Using this causes the simplifications to be performed in ccp1 instead of
fwprop1. I noticed two tests failing that rely on propagation being
performed in fwprop. Should these be adapted or rather the patch be changed?
ISTM this is an indication that something changed the IL without folding prior to ccp & forwprop. That's not in and of itself bad, but may be worth investigating to see if whatever prior pass that made this change ought to be adjusted.

That investigation would likely guide you with what to do with the testcase. If you find that the earlier pass should have folded, then you fix it and change the testcase to verify the earlier pass folded properly. Else you change the testcase to verify ccp folds the statement.

I'm going to let Richi own the review on this. Just thought I'd chime in on that one topic.

Reply via email to