aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-pure-const.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-06-10 13:07:24 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-06-10 11:07:24 +0000
commit97e59627567757759b047479c75be2f238ea45c3 (patch)
tree6ab525ca7d4657f2ef09734d2df43aa84ed4caf4 /gcc/ipa-pure-const.c
parent54e2d83caf591eb1ca3e6e8df44d67a4ac44d8fe (diff)
downloadgcc-97e59627567757759b047479c75be2f238ea45c3.zip
gcc-97e59627567757759b047479c75be2f238ea45c3.tar.gz
gcc-97e59627567757759b047479c75be2f238ea45c3.tar.bz2
Reduce SCCs in IPA postorder.
2019-06-10 Martin Liska <mliska@suse.cz> * ipa-cp.c (ignore_edge_p): New function. (build_toporder_info): Use it. * ipa-inline.c (ignore_edge_p): New function/ (inline_small_functions): Use it. * ipa-pure-const.c (ignore_edge_for_nothrow): Verify opt_for_fn for caller and callee. (ignore_edge_for_pure_const): Likewise. * ipa-reference.c (ignore_edge_p): Extend to check for opt_for_fn. * ipa-utils.c (searchc): Refactor. * ipa-utils.h: Fix coding style. From-SVN: r272115
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r--gcc/ipa-pure-const.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index bb561d0..f5e5396 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1361,12 +1361,14 @@ ignore_edge_for_nothrow (struct cgraph_edge *e)
return true;
enum availability avail;
- cgraph_node *n = e->callee->function_or_virtual_thunk_symbol (&avail,
- e->caller);
- if (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (n->decl))
+ cgraph_node *ultimate_target
+ = e->callee->function_or_virtual_thunk_symbol (&avail, e->caller);
+ if (avail <= AVAIL_INTERPOSABLE || TREE_NOTHROW (ultimate_target->decl))
return true;
- return opt_for_fn (e->callee->decl, flag_non_call_exceptions)
- && !e->callee->binds_to_current_def_p (e->caller);
+ return ((opt_for_fn (e->callee->decl, flag_non_call_exceptions)
+ && !e->callee->binds_to_current_def_p (e->caller))
+ || !opt_for_fn (e->caller->decl, flag_ipa_pure_const)
+ || !opt_for_fn (ultimate_target->decl, flag_ipa_pure_const));
}
/* Return true if NODE is self recursive function.
@@ -1396,16 +1398,21 @@ cdtor_p (cgraph_node *n, void *)
return false;
}
-/* We only propagate across edges with non-interposable callee. */
+/* Skip edges from and to nodes without ipa_pure_const enabled.
+ Ignore not available symbols. */
static bool
ignore_edge_for_pure_const (struct cgraph_edge *e)
{
enum availability avail;
- e->callee->function_or_virtual_thunk_symbol (&avail, e->caller);
- return (avail <= AVAIL_INTERPOSABLE);
-}
+ cgraph_node *ultimate_target
+ = e->callee->function_or_virtual_thunk_symbol (&avail, e->caller);
+ return (avail <= AVAIL_INTERPOSABLE
+ || !opt_for_fn (e->caller->decl, flag_ipa_pure_const)
+ || !opt_for_fn (ultimate_target->decl,
+ flag_ipa_pure_const));
+}
/* Produce transitive closure over the callgraph and compute pure/const
attributes. */