From: Andrew Pinski <apin...@marvell.com>

Even though this does not change the generated code,
it does improve the initial RTL generation.

gcc/ChangeLog:

        * tree-ssa-math-opts.c (match_arith_overflow):
        Add range and nonzero bits information to
        the new overflow ssa name.  Also fold
        the use statement.
---
 gcc/tree-ssa-math-opts.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index c4a6492b50d..bb7edeaa6f7 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -4221,6 +4221,8 @@ match_arith_overflow (gimple_stmt_iterator *gsi, gimple 
*stmt,
        }
     }
   tree ovf = make_ssa_name (type);
+  set_range_info (ovf, VR_RANGE, wi::zero (TYPE_PRECISION (type)), wi::one 
(TYPE_PRECISION (type)));
+  set_nonzero_bits (ovf, wi::one (TYPE_PRECISION (type)));
   g2 = gimple_build_assign (ovf, IMAGPART_EXPR,
                            build1 (IMAGPART_EXPR, type, ctmp));
   if (code != BIT_NOT_EXPR)
@@ -4279,6 +4281,8 @@ match_arith_overflow (gimple_stmt_iterator *gsi, gimple 
*stmt,
              gimple_assign_set_rhs1 (use_stmt, cond);
            }
        }
+      gimple_stmt_iterator gsi1 = gsi_for_stmt (use_stmt);
+      fold_stmt (&gsi1);
       update_stmt (use_stmt);
       if (code == MULT_EXPR && use_stmt != orig_use_stmt)
        {
-- 
2.27.0

Reply via email to