summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-15 16:56:01 +0000
committerdehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-15 16:56:01 +0000
commit341de017d77ba2a92b265446516b472cb46ec7f4 (patch)
tree0d27f935f2366cda4b8120bd06b4c6a9c25ca62d
parent90ba0d1e9da9352f269b91cdb4d9617a1839d489 (diff)
downloadgcc-341de017d77ba2a92b265446516b472cb46ec7f4.tar.gz
2013-06-15 Dehao Chen <dehao@google.com>
* tree-flow.h (gimple_check_call_matching_types): Add new argument. * gimple-low.c (gimple_check_call_matching_types): Likewise. (gimple_check_call_args): Likewise. * value-prof.c (check_ic_target): Likewise. * ipa-inline.c (early_inliner): Likewise. * ipa-prop.c (update_indirect_edges_after_inlining): Likewise. * cgraph.c (cgraph_create_edge_1): Likewise. (cgraph_make_edge_direct): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200125 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cgraph.c6
-rw-r--r--gcc/gimple-low.c12
-rw-r--r--gcc/ipa-inline.c4
-rw-r--r--gcc/ipa-prop.c5
-rw-r--r--gcc/tree-flow.h2
-rw-r--r--gcc/value-prof.c2
7 files changed, 30 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 66903b453b3..d4a35462384 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2013-06-15 Dehao Chen <dehao@google.com>
+
+ * tree-flow.h (gimple_check_call_matching_types): Add new argument.
+ * gimple-low.c (gimple_check_call_matching_types): Likewise.
+ (gimple_check_call_args): Likewise.
+ * value-prof.c (check_ic_target): Likewise.
+ * ipa-inline.c (early_inliner): Likewise.
+ * ipa-prop.c (update_indirect_edges_after_inlining): Likewise.
+ * cgraph.c (cgraph_create_edge_1): Likewise.
+ (cgraph_make_edge_direct): Likewise.
+
2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/57615
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 797d58a0020..a2ec60221e9 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -818,7 +818,8 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
pop_cfun ();
if (call_stmt
&& callee && callee->symbol.decl
- && !gimple_check_call_matching_types (call_stmt, callee->symbol.decl))
+ && !gimple_check_call_matching_types (call_stmt, callee->symbol.decl,
+ false))
edge->call_stmt_cannot_inline_p = true;
else
edge->call_stmt_cannot_inline_p = false;
@@ -1018,7 +1019,8 @@ cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee)
if (edge->call_stmt)
edge->call_stmt_cannot_inline_p
- = !gimple_check_call_matching_types (edge->call_stmt, callee->symbol.decl);
+ = !gimple_check_call_matching_types (edge->call_stmt, callee->symbol.decl,
+ false);
/* We need to re-determine the inlining status of the edge. */
initialize_inline_failed (edge);
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index b06d194da65..64cc031785d 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -204,7 +204,7 @@ struct gimple_opt_pass pass_lower_cf =
return false. */
static bool
-gimple_check_call_args (gimple stmt, tree fndecl)
+gimple_check_call_args (gimple stmt, tree fndecl, bool args_count_match)
{
tree parms, p;
unsigned int i, nargs;
@@ -243,6 +243,8 @@ gimple_check_call_args (gimple stmt, tree fndecl)
&& !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
return false;
}
+ if (args_count_match && p)
+ return false;
}
else if (parms)
{
@@ -271,11 +273,13 @@ gimple_check_call_args (gimple stmt, tree fndecl)
}
/* Verify if the type of the argument and lhs of CALL_STMT matches
- that of the function declaration CALLEE.
+ that of the function declaration CALLEE. If ARGS_COUNT_MATCH is
+ true, the arg count needs to be the same.
If we cannot verify this or there is a mismatch, return false. */
bool
-gimple_check_call_matching_types (gimple call_stmt, tree callee)
+gimple_check_call_matching_types (gimple call_stmt, tree callee,
+ bool args_count_match)
{
tree lhs;
@@ -285,7 +289,7 @@ gimple_check_call_matching_types (gimple call_stmt, tree callee)
&& !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)),
TREE_TYPE (lhs))
&& !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs))
- || !gimple_check_call_args (call_stmt, callee))
+ || !gimple_check_call_args (call_stmt, callee, args_count_match))
return false;
return true;
}
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 283e517c6dc..5d50bb43604 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2054,8 +2054,8 @@ early_inliner (void)
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
if (edge->callee->symbol.decl
- && !gimple_check_call_matching_types (edge->call_stmt,
- edge->callee->symbol.decl))
+ && !gimple_check_call_matching_types (
+ edge->call_stmt, edge->callee->symbol.decl, false))
edge->call_stmt_cannot_inline_p = true;
}
timevar_pop (TV_INTEGRATION);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 8918c5b3bf5..a65adbbe331 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2468,8 +2468,9 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
new_direct_edge->indirect_inlining_edge = 1;
if (new_direct_edge->call_stmt)
new_direct_edge->call_stmt_cannot_inline_p
- = !gimple_check_call_matching_types (new_direct_edge->call_stmt,
- new_direct_edge->callee->symbol.decl);
+ = !gimple_check_call_matching_types (
+ new_direct_edge->call_stmt,
+ new_direct_edge->callee->symbol.decl, false);
if (new_edges)
{
new_edges->safe_push (new_direct_edge);
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 24fcfbfe920..caa8d7457fb 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -464,7 +464,7 @@ extern void record_vars_into (tree, tree);
extern void record_vars (tree);
extern bool gimple_seq_may_fallthru (gimple_seq);
extern bool gimple_stmt_may_fallthru (gimple);
-extern bool gimple_check_call_matching_types (gimple, tree);
+extern bool gimple_check_call_matching_types (gimple, tree, bool);
/* In tree-ssa.c */
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index b665b1c3904..67bc2c8ea8e 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1231,7 +1231,7 @@ static bool
check_ic_target (gimple call_stmt, struct cgraph_node *target)
{
location_t locus;
- if (gimple_check_call_matching_types (call_stmt, target->symbol.decl))
+ if (gimple_check_call_matching_types (call_stmt, target->symbol.decl, true))
return true;
locus = gimple_location (call_stmt);