summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline-transform.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-12 05:44:52 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-12 05:44:52 +0000
commit7ab096e0dd34827ca3e19a7378af363200ea07e1 (patch)
tree8ac0aecfa0363647ac374049bbb636b19fed1996 /gcc/ipa-inline-transform.c
parent8f1e4ff94934f3cba74c6cfa1775c103220e7c83 (diff)
downloadgcc-7ab096e0dd34827ca3e19a7378af363200ea07e1.tar.gz
PR ipa/65743
* ipa-inline-transform.c (speculation_removed): Remove static var. (check_speculations): New function. (clone_inlined_nodes): Do not check spculations. (inline_call): Call check_speculations. * ipa-prop.c (ipa_make_edge_direct_to_target): Do not consider non-invariants. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222017 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline-transform.c')
-rw-r--r--gcc/ipa-inline-transform.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 99ed512ea96..5a628f39dd6 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -64,7 +64,6 @@ along with GCC; see the file COPYING3. If not see
int ncalls_inlined;
int nfunctions_inlined;
-bool speculation_removed;
/* Scale frequency of NODE edges by FREQ_SCALE. */
@@ -256,12 +255,29 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
next = e->next_callee;
if (!e->inline_failed)
clone_inlined_nodes (e, duplicate, update_original, overall_size, freq_scale);
+ }
+}
+
+/* Check all speculations in N and resolve them if they seems useless. */
+
+static bool
+check_speculations (cgraph_node *n)
+{
+ bool speculation_removed = false;
+ cgraph_edge *next;
+
+ for (cgraph_edge *e = n->callees; e; e = next)
+ {
+ next = e->next_callee;
if (e->speculative && !speculation_useful_p (e, true))
{
e->resolve_speculation (NULL);
speculation_removed = true;
}
+ else if (!e->inline_failed)
+ speculation_removed |= check_speculations (e->callee);
}
+ return speculation_removed;
}
/* Mark all call graph edges coming out of NODE and all nodes that have been
@@ -310,7 +326,6 @@ inline_call (struct cgraph_edge *e, bool update_original,
bool predicated = inline_edge_summary (e)->predicate != NULL;
#endif
- speculation_removed = false;
/* Don't inline inlined edges. */
gcc_assert (e->inline_failed);
/* Don't even think of inlining inline clone. */
@@ -360,6 +375,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
mark_all_inlined_calls_cdtor (e->callee);
if (opt_for_fn (e->caller->decl, optimize))
new_edges_found = ipa_propagate_indirect_call_infos (curr, new_edges);
+ check_speculations (e->callee);
if (update_overall_summary)
inline_update_overall_summary (to);
new_size = inline_summaries->get (to)->size;