This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/5] Fix indirect inlining fallout with new intra-SRA
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Guenther <rguenther at suse dot de>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 28 Apr 2009 12:04:33 +0200
- Subject: [PATCH 4/5] Fix indirect inlining fallout with new intra-SRA
- References: <20090428100429.051912011@virgil.suse.cz>
The new intra-SRA produces an extra copy assignment and that breaks
ipa-prop.c pattern matching. The following patch fixes that.
Thanks,
Martin
2009-04-27 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (get_ssa_def_if_simple_copy): New function.
(determine_cst_member_ptr): Call get_ssa_def_if_simple_copy to skip
simple copies.
Index: mine/gcc/ipa-prop.c
===================================================================
--- mine.orig/gcc/ipa-prop.c
+++ mine/gcc/ipa-prop.c
@@ -456,6 +456,22 @@ fill_member_ptr_cst_jump_function (struc
jfunc->value.member_cst.delta = delta;
}
+/* If RHS is an SSA_NAMe and it is defined by a simple copy assign statement,
+ return the rhs of its defining statement. */
+
+static inline tree
+get_ssa_def_if_simple_copy (tree rhs)
+{
+ if (TREE_CODE (rhs) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (rhs))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (rhs);
+
+ if (is_gimple_assign (def_stmt) && gimple_num_ops (def_stmt) == 2)
+ rhs = gimple_assign_rhs1 (def_stmt);
+ }
+ return rhs;
+}
+
/* Traverse statements from CALL backwards, scanning whether the argument ARG
which is a member pointer is filled in with constant values. If it is, fill
the jump function JFUNC in appropriately. METHOD_FIELD and DELTA_FIELD are
@@ -495,6 +511,7 @@ determine_cst_member_ptr (gimple call, t
fld = TREE_OPERAND (lhs, 1);
if (!method && fld == method_field)
{
+ rhs = get_ssa_def_if_simple_copy (rhs);
if (TREE_CODE (rhs) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (rhs, 0))) == METHOD_TYPE)
@@ -512,6 +529,7 @@ determine_cst_member_ptr (gimple call, t
if (!delta && fld == delta_field)
{
+ rhs = get_ssa_def_if_simple_copy (rhs);
if (TREE_CODE (rhs) == INTEGER_CST)
{
delta = rhs;