tree-vrp.c (vrp_visit_assignment_or_call): Handle simplifications to SSA names via...
authorRichard Biener <rguenther@suse.de>
Mon, 28 Nov 2016 15:04:45 +0000 (15:04 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 28 Nov 2016 15:04:45 +0000 (15:04 +0000)
2016-11-28  Richard Biener  <rguenther@suse.de>

* tree-vrp.c (vrp_visit_assignment_or_call): Handle
simplifications to SSA names via extract_range_from_ssa_name
if allowed.

From-SVN: r242921

gcc/ChangeLog
gcc/tree-vrp.c

index 15129d98b53a1d9b7a6fa84e9d80c8c55940a7da..9baf4bd8d46c07d93ebb9ff842a5f40124f77402 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-28  Richard Biener  <rguenther@suse.de>
+
+       * tree-vrp.c (vrp_visit_assignment_or_call): Handle
+       simplifications to SSA names via extract_range_from_ssa_name
+       if allowed.
+
 2016-11-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/78542
index 8bea4dbc3fb49549f1621258d5745244ef0cce6c..f3d571d98b2898d6109182e836a601c25413ac60 100644 (file)
@@ -7132,17 +7132,31 @@ vrp_visit_assignment_or_call (gimple *stmt, tree *output_p, value_range *vr)
           && TYPE_MAX_VALUE (TREE_TYPE (lhs)))
          || POINTER_TYPE_P (TREE_TYPE (lhs))))
     {
+      *output_p = lhs;
+
       /* Try folding the statement to a constant first.  */
       tree tem = gimple_fold_stmt_to_constant_1 (stmt, vrp_valueize,
                                                 vrp_valueize_1);
-      if (tem && is_gimple_min_invariant (tem))
-       set_value_range_to_value (vr, tem, NULL);
+      if (tem)
+       {
+         if (TREE_CODE (tem) == SSA_NAME
+             && (SSA_NAME_IS_DEFAULT_DEF (tem)
+                 || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (tem))))
+           {
+             extract_range_from_ssa_name (vr, tem);
+             return;
+           }
+         else if (is_gimple_min_invariant (tem))
+           {
+             set_value_range_to_value (vr, tem, NULL);
+             return;
+           }
+       }
       /* Then dispatch to value-range extracting functions.  */
-      else if (code == GIMPLE_CALL)
+      if (code == GIMPLE_CALL)
        extract_range_basic (vr, stmt);
       else
        extract_range_from_assignment (vr, as_a <gassign *> (stmt));
-      *output_p = lhs;
     }
 }