This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
IPA merge: make ipa-type-escape and ipa-pure-const deal with SSA form
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Dec 2006 20:52:54 +0100
- Subject: IPA merge: make ipa-type-escape and ipa-pure-const deal with SSA form
Hi,
this patch makes ipe-pure-const and ipa-type-escape to "tolerate" (ie work on
but not take advantage of) the SSA form. I've bootstrapped/regtested the change
on x86_64-linux with IPA-SSA and running routine bootstrap/regtest on clean
mainline i686-linux now. Will commit it as obvious once testing converge.
Honza
* ipa-pure-const.c (check_operand): Handle SSA_NAME.
* ipa-type-escape.c (check_operand, look_for_address_of, scan_for_refs):
Handle SSA_NAME
Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c (revision 120209)
+++ ipa-pure-const.c (working copy)
@@ -163,7 +163,8 @@ check_operand (funct_state local,
static void
check_tree (funct_state local, tree t, bool checking_write)
{
- if ((TREE_CODE (t) == EXC_PTR_EXPR) || (TREE_CODE (t) == FILTER_EXPR))
+ if ((TREE_CODE (t) == EXC_PTR_EXPR) || (TREE_CODE (t) == FILTER_EXPR)
+ || TREE_CODE (t) == SSA_NAME)
return;
/* Any tree which is volatile disqualifies thie function from being
Index: ipa-type-escape.c
===================================================================
--- ipa-type-escape.c (revision 120209)
+++ ipa-type-escape.c (working copy)
@@ -796,6 +796,8 @@ check_operand (tree t)
if (TREE_CODE (t) == FUNCTION_DECL)
check_function_parameter_and_return_types (t, true);
+ else if (TREE_CODE (t) == SSA_NAME)
+ has_proper_scope_for_analysis (SSA_NAME_VAR (t));
else if (TREE_CODE (t) == VAR_DECL)
has_proper_scope_for_analysis (t);
}
@@ -821,6 +823,9 @@ check_tree (tree t)
/* || TREE_CODE (t) == MEM_REF) */
check_tree (TREE_OPERAND (t, 0));
+ if (TREE_CODE (t) == SSA_NAME)
+ t = SSA_NAME_VAR (t);
+
if (SSA_VAR_P (t) || (TREE_CODE (t) == FUNCTION_DECL))
check_operand (t);
}
@@ -903,6 +908,8 @@ look_for_address_of (tree t)
cref = TREE_OPERAND (cref, 0);
}
+ if (TREE_CODE (x) == SSA_NAME)
+ has_proper_scope_for_analysis (SSA_NAME_VAR (x));
if (TREE_CODE (x) == VAR_DECL)
has_proper_scope_for_analysis (x);
}
@@ -1267,7 +1274,11 @@ scan_for_refs (tree *tp, int *walk_subtr
result so we do mark the resulting cast as being
bad. */
if (check_call (rhs))
- bitmap_set_bit (results_of_malloc, DECL_UID (lhs));
+ {
+ if (TREE_CODE (lhs) == SSA_NAME)
+ lhs = SSA_NAME_VAR (lhs);
+ bitmap_set_bit (results_of_malloc, DECL_UID (lhs));
+ }
break;
default:
break;