tree-vrp.c (stmt_interesting_for_vrp): Some statements with virtual operands are...
authorJeff Law <law@redhat.com>
Mon, 13 Mar 2006 16:32:34 +0000 (09:32 -0700)
committerJeff Law <law@gcc.gnu.org>
Mon, 13 Mar 2006 16:32:34 +0000 (09:32 -0700)
* tree-vrp.c (stmt_interesting_for_vrp): Some statements with
virtual operands are interesting.
(vrp_visit_stmt): Corresponding changes.

* gcc.dg/tree-ssa/20030807-2.c: No longer expected to fail.

From-SVN: r112011

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/20030807-2.c
gcc/tree-vrp.c

index 61cf790..abdc285 100644 (file)
@@ -1,3 +1,9 @@
+2006-03-13  Jeff Law  <law@redhat.com>
+
+       * tree-vrp.c (stmt_interesting_for_vrp): Some statements with
+       virtual operands are interesting.
+       (vrp_visit_stmt): Corresponding changes.
+
 2006-03-13  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/lib1funcs.asm (___umodsi3): Use stack to save contents
index 6ae2bca..e998c9d 100644 (file)
@@ -1,3 +1,7 @@
+2006-03-13  Jeff Law  <law@redhat.com>
+
+       * gcc.dg/tree-ssa/20030807-2.c: No longer expected to fail.
+
 2006-03-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/switch-9.c: New test.
index a019d55..29e793e 100644 (file)
@@ -24,5 +24,5 @@ foo(int n)
 
                                                                                
 /* There should be no IF conditionals.  */
-/* { dg-final { scan-tree-dump-times "if " 0 "dom3" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */
 /* { dg-final { cleanup-tree-dump "dom3" } } */
index e126fea..278347d 100644 (file)
@@ -3266,11 +3266,19 @@ stmt_interesting_for_vrp (tree stmt)
   else if (TREE_CODE (stmt) == MODIFY_EXPR)
     {
       tree lhs = TREE_OPERAND (stmt, 0);
+      tree rhs = TREE_OPERAND (stmt, 1);
 
+      /* In general, assignments with virtual operands are not useful
+        for deriving ranges, with the obvious exception of calls to
+        builtin functions.  */
       if (TREE_CODE (lhs) == SSA_NAME
          && (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
              || POINTER_TYPE_P (TREE_TYPE (lhs)))
-         && ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
+         && ((TREE_CODE (rhs) == CALL_EXPR
+              && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
+              && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
+              && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
+             || ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
        return true;
     }
   else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR)
@@ -3739,9 +3747,20 @@ vrp_visit_stmt (tree stmt, edge *taken_edge_p, tree *output_p)
     }
 
   ann = stmt_ann (stmt);
-  if (TREE_CODE (stmt) == MODIFY_EXPR
-      && ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
-    return vrp_visit_assignment (stmt, output_p);
+  if (TREE_CODE (stmt) == MODIFY_EXPR)
+    {
+      tree rhs = TREE_OPERAND (stmt, 1);
+
+      /* In general, assignments with virtual operands are not useful
+        for deriving ranges, with the obvious exception of calls to
+        builtin functions.  */
+      if ((TREE_CODE (rhs) == CALL_EXPR
+          && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
+          && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
+          && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
+         || ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
+       return vrp_visit_assignment (stmt, output_p);
+    }
   else if (TREE_CODE (stmt) == COND_EXPR || TREE_CODE (stmt) == SWITCH_EXPR)
     return vrp_visit_cond_stmt (stmt, taken_edge_p);