OSDN Git Service

2007-08-30 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Aug 2007 14:52:28 +0000 (14:52 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Aug 2007 14:52:28 +0000 (14:52 +0000)
PR tree-optimization/33199
* tree-ssa-structalias.c (handle_lhs_call): New function.
(find_func_aliases): In non-IPA mode make sure that for
calls that return a pointer we add a constraint for the
result to point to anything.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127927 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e5d5249..f706cff 100644 (file)
@@ -1,5 +1,13 @@
 2007-08-30  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/33199
+       * tree-ssa-structalias.c (handle_lhs_call): New function.
+       (find_func_aliases): In non-IPA mode make sure that for
+       calls that return a pointer we add a constraint for the
+       result to point to anything.
+
+2007-08-30  Richard Guenther  <rguenther@suse.de>
+
        * doc/invoke.texi (-mveclibabi): Document new target option.
        * config/i386/i386.opt (-mveclibabi): New target option.
        * config/i386/i386.c (ix86_veclib_handler): Handler for
index dbece90..a379e7e 100644 (file)
@@ -3655,6 +3655,27 @@ handle_rhs_call  (tree rhs)
     }
 }
 
+/* For non-IPA mode, generate constraints necessary for a call
+   that returns a pointer and assigns it to LHS.  This simply makes
+   the LHS point to anything.  */
+
+static void
+handle_lhs_call (tree lhs)
+{
+  VEC(ce_s, heap) *lhsc = NULL;
+  struct constraint_expr rhsc;
+  unsigned int j;
+  struct constraint_expr *lhsp;
+
+  rhsc.var = anything_id;
+  rhsc.offset = 0;
+  rhsc.type = ADDRESSOF;
+  get_constraint_for (lhs, &lhsc);
+  for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
+    process_constraint_1 (new_constraint (*lhsp, rhsc), true);
+  VEC_free (ce_s, heap, lhsc);
+}
+
 /* Walk statement T setting up aliasing constraints according to the
    references found in T.  This function is the main part of the
    constraint builder.  AI points to auxiliary alias information used
@@ -3726,7 +3747,11 @@ find_func_aliases (tree origt)
       if (!in_ipa_mode)
        {
          if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
-           handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1));
+           {
+             handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1));
+             if (POINTER_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (t, 1))))
+               handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0));
+           }
          else
            handle_rhs_call (t);
        }