aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2004-03-19 17:51:45 +0000
committerJeff Law <law@redhat.com>2004-03-19 17:51:45 +0000
commit26247cd4dd14b31f0c3f1a478d8a1133cd84bbfa (patch)
treed0b47f415e972ea03d70d784a1160313ccc2c6e8
parent05b3c5d398c4861a5a275dc1fbdf7fc8274769a1 (diff)
* tree-dfa.c (find_hidden_use_vars): Also look inside the
PENDING_SIZES list for hidden uses. * tree-optimize.c (tree_rest_of_compilation): Expand used variables before setting up parameters. * tree-ssa-copyrename.c (rename_ssa_copies): Do nothing for copies where the LHS has a hidden use. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79692 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.tree-ssa9
-rw-r--r--gcc/tree-dfa.c17
-rw-r--r--gcc/tree-optimize.c9
-rw-r--r--gcc/tree-ssa-copyrename.c12
4 files changed, 40 insertions, 7 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa
index a91a9190733..2f6f7fb3a0f 100644
--- a/gcc/ChangeLog.tree-ssa
+++ b/gcc/ChangeLog.tree-ssa
@@ -1,3 +1,12 @@
+2003-03-19 Jeff Law <law@redhat.com>
+
+ * tree-dfa.c (find_hidden_use_vars): Also look inside the
+ PENDING_SIZES list for hidden uses.
+ * tree-optimize.c (tree_rest_of_compilation): Expand used variables
+ before setting up parameters.
+ * tree-ssa-copyrename.c (rename_ssa_copies): Do nothing for copies
+ where the LHS has a hidden use.
+
2004-03-18 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (TREE_FLOW_H): Reformat.
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 8d50ccbaa5f..4caa26b5aaa 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -1000,7 +1000,7 @@ get_virtual_var (tree var)
static void
find_hidden_use_vars (tree block)
{
- tree sub, decl;
+ tree sub, decl, tem;
/* Check all the arrays declared in the block for VLAs.
@@ -1015,6 +1015,21 @@ find_hidden_use_vars (tree block)
/* Now repeat the search in any sub-blocks. */
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
find_hidden_use_vars (sub);
+
+ /* A VLA parameter may use a variable which as set from another
+ parameter to declare the size of the VLA. We need to mark the
+ variable as having a hidden use since it is used to declare the
+ VLA parameter and that declaration is not seen by the SSA code.
+
+ Note get_pending_sizes clears the PENDING_SIZES chain, so we
+ must restore it. */
+ tem = get_pending_sizes ();
+ put_pending_sizes (tem);
+ for (; tem; tem = TREE_CHAIN (tem))
+ {
+ int inside_vla = 1;
+ walk_tree (&TREE_VALUE (tem), find_hidden_use_vars_r, &inside_vla, NULL);
+ }
}
/* Callback for walk_tree used by find_hidden_use_vars to analyze each
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index e7778cff9f1..6af4b029389 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -534,12 +534,15 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
walk_tree (&TREE_TYPE (fndecl), set_save_expr_context, fndecl,
NULL);
+ /* Expand the variables recorded during gimple lowering. This must
+ occur before the call to expand_function_start to ensure that
+ all used variables are expanded before we expand anything on the
+ PENDING_SIZES list. */
+ expand_used_vars ();
+
/* Set up parameters and prepare for return, for the function. */
expand_function_start (fndecl, 0);
- /* Expand the variables recorded during gimple lowering. */
- expand_used_vars ();
-
/* Allow language dialects to perform special processing. */
(*lang_hooks.rtl_expand.start) ();
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 8451d0e83a9..8251158f1e4 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -274,9 +274,13 @@ rename_ssa_copies (void)
{
int i;
tree res = PHI_RESULT (phi);
- /* Dont process virtual SSA_NAMES. */
- if (!is_gimple_reg (SSA_NAME_VAR (res)))
+
+ /* Do not process virtual SSA_NAMES or variables which have
+ hidden uses. */
+ if (!is_gimple_reg (SSA_NAME_VAR (res))
+ || has_hidden_use (SSA_NAME_VAR (res)))
continue;
+
for (i = 0; i < PHI_NUM_ARGS (phi); i++)
{
tree arg = PHI_ARG_DEF (phi, i);
@@ -294,7 +298,9 @@ rename_ssa_copies (void)
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
- if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
+ if (TREE_CODE (lhs) == SSA_NAME
+ && !has_hidden_use (SSA_NAME_VAR (lhs))
+ && TREE_CODE (rhs) == SSA_NAME)
copy_rename_partition_coalesce (map, lhs, rhs, debug);
}
}