tree-ssa-alias.c (compute_points_to_and_addr_escapes): Remove special code for assign...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Mon, 29 Nov 2004 00:59:25 +0000 (00:59 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 29 Nov 2004 00:59:25 +0000 (19:59 -0500)
* tree-ssa-alias.c (compute_points_to_and_addr_escapes): Remove
special code for assigning to non-pointer.
(is_escape_site): If RHS is a conversion between pointer and integer
types, this is an escape site.

From-SVN: r91448

gcc/ChangeLog
gcc/tree-ssa-alias.c

index 8724e4c44eb77b0e930f0ec7e7141b2a2906c6e2..87d29bc7e01be7bb1b1158227683f599b783fa4e 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-28  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
+       * tree-ssa-alias.c (compute_points_to_and_addr_escapes): Remove
+       special code for assigning to non-pointer.
+       (is_escape_site): If RHS is a conversion between pointer and integer
+       types,  this is an escape site.
+
        * gcse.c (insert_store): Error if try to insert store on abnormal edge.
        (store_motion): Don't move store if any edge we'd want to move it
        to is abnormal.
index d6391db3d7cab64db2ea9f975f6d133c9046bffd..3fce93a8001437234a604590f9941022d9fc0d93 100644 (file)
@@ -195,7 +195,8 @@ tree global_var;
    The concept of 'escaping' is the same one used in the Java world.  When
    a pointer or an ADDR_EXPR escapes, it means that it has been exposed
    outside of the current function.  So, assignment to global variables,
-   function arguments and returning a pointer are all escape sites.
+   function arguments and returning a pointer are all escape sites, as are
+   conversions between pointers and integers.
 
    This is where we are currently limited.  Since not everything is renamed
    into SSA, we lose track of escape properties when a pointer is stashed
@@ -662,22 +663,6 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
          if (stmt_escapes_p)
            block_ann->has_escape_site = 1;
 
-         /* Special case for silly ADDR_EXPR tricks
-            (gcc.c-torture/unsorted/pass.c).  If this statement is an
-            assignment to a non-pointer variable and the RHS takes the
-            address of a variable, assume that the variable on the RHS is
-            call-clobbered.  We could add the LHS to the list of
-            "pointers" and follow it to see if it really escapes, but it's
-            not worth the pain.  */
-         if (addr_taken
-             && TREE_CODE (stmt) == MODIFY_EXPR
-             && !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 0))))
-           EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi)
-             {
-               tree var = referenced_var (i);
-               mark_call_clobbered (var);
-             }
-
          FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
            {
              var_ann_t v_ann = var_ann (SSA_NAME_VAR (op));
@@ -2049,6 +2034,16 @@ is_escape_site (tree stmt, size_t *num_calls_p)
       if (lhs == NULL_TREE)
        return true;
 
+      /* If the RHS is a conversion between a pointer and an integer, the
+        pointer escapes since we can't track the integer.  */
+      if ((TREE_CODE (TREE_OPERAND (stmt, 1)) == NOP_EXPR
+          || TREE_CODE (TREE_OPERAND (stmt, 1)) == CONVERT_EXPR
+          || TREE_CODE (TREE_OPERAND (stmt, 1)) == VIEW_CONVERT_EXPR)
+         && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND
+                                       (TREE_OPERAND (stmt, 1), 0)))
+         && !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 1))))
+       return true;
+
       /* If the LHS is an SSA name, it can't possibly represent a non-local
         memory store.  */
       if (TREE_CODE (lhs) == SSA_NAME)