[Bug tree-optimization/84061] New: [8 Regression] gcc.dg/tree-ssa/loop-15.c XFAIL

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 26 10:36:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84061

            Bug ID: 84061
           Summary: [8 Regression] gcc.dg/tree-ssa/loop-15.c XFAIL
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, xfail
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

After r257077 we fail to fold (int) ((unsigned int) n_5 + 4294967295) * n_5 +
n_5
to n_5 * n_5.  Before the rev. we managed to fold to (int)((unsigned)n_5 *
(unsigned)n_5) via fold_plusminus_mult_expr.

The rev. contains everything necessary to fold this during late VRP to n_5 *
n_5
but the substitute-and-fold engine doesn't fold all stmts.

The following fixes this regression:

Index: gcc/tree-ssa-propagate.c
===================================================================
--- gcc/tree-ssa-propagate.c    (revision 257048)
+++ gcc/tree-ssa-propagate.c    (working copy)
@@ -1056,13 +1056,17 @@ substitute_and_fold_dom_walker::before_d
                           && gimple_call_noreturn_p (stmt));

       /* Replace real uses in the statement.  */
-      did_replace |= substitute_and_fold_engine->replace_uses_in (stmt);
+      if (substitute_and_fold_engine->replace_uses_in (stmt))
+       {
+         did_replace = true;
+         gimple_set_modified (stmt, true);
+       }

-      /* 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);
          stmt = gsi_stmt (i);
+         did_replace = true;
          gimple_set_modified (stmt, true);
        }


queued for GCC 9.


More information about the Gcc-bugs mailing list