OSDN Git Service

2012-05-07 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 May 2012 13:00:39 +0000 (13:00 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 May 2012 13:00:39 +0000 (13:00 +0000)
PR tree-optimization/53195
* tree-inline.c (setup_one_parameter): Properly add referenced
vars from the parameters new known value.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@187237 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-inline.c

index cf0eba7..9311d72 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/53195
+       * tree-inline.c (setup_one_parameter): Properly add referenced
+       vars from the parameters new known value.
+
 2012-05-06  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        Backport from mainline:
index ae773f6..1ee6c4a 100644 (file)
@@ -2607,6 +2607,17 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
   /* Make gimplifier happy about this variable.  */
   DECL_SEEN_IN_BIND_EXPR_P (var) = 1;
 
+  /* We are eventually using the value - make sure all variables
+     referenced therein are properly recorded.  */
+  if (value
+      && gimple_in_ssa_p (cfun)
+      && TREE_CODE (value) == ADDR_EXPR)
+    {
+      tree base = get_base_address (TREE_OPERAND (value, 0));
+      if (base && TREE_CODE (base) == VAR_DECL)
+       add_referenced_var (base);
+    }
+
   /* If the parameter is never assigned to, has no SSA_NAMEs created,
      we would not need to create a new variable here at all, if it
      weren't for debug info.  Still, we can just use the argument