From 8413ca874e088161ca0fbc3bf3a98cffc45564f3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 Nov 2014 18:46:50 +0100 Subject: ipa-pure-const.c (struct funct_state_d): Add can_free field. * ipa-pure-const.c (struct funct_state_d): Add can_free field. (varying_state): Add true for can_free. (check_call): For builtin or internal !nonfreeing_call_p set local->can_free. (check_stmt): For asm volatile and asm with "memory" set local->can_free. (analyze_function): Clear local->can_free initially, continue calling check_stmt until all flags are computed, dump can_free flag. (pure_const_write_summary): Write can_free flag. (pure_const_read_summary): Read it back. (propagate_pure_const): Propagate also can_free flag, set w->nonfreeing_fn if it is false after propagation. * cgraph.h (cgraph_node): Add nonfreeing_fn member. * gimple.c: Include ipa-ref.h, lto-streamer.h and cgraph.h. (nonfreeing_call_p): Return cgraph nonfreeing_fn flag if set. Also return true for IFN_ABNORMAL_DISPATCHER. * cgraph.c (cgraph_node::dump): Dump nonfreeing_fn flag. * lto-cgraph.c (lto_output_node): Write nonfreeing_fn flag. (input_overwrite_node): Read it back. From-SVN: r217582 --- gcc/gimple.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'gcc/gimple.c') diff --git a/gcc/gimple.c b/gcc/gimple.c index ac75365..f8459a4 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -58,6 +58,9 @@ along with GCC; see the file COPYING3. If not see #include "bitmap.h" #include "stringpool.h" #include "tree-ssanames.h" +#include "ipa-ref.h" +#include "lto-streamer.h" +#include "cgraph.h" /* All the tuples have their operand vector (if present) at the very bottom @@ -2538,11 +2541,28 @@ nonfreeing_call_p (gimple call) default: return true; } - else if (gimple_call_internal_p (call) - && gimple_call_flags (call) & ECF_LEAF) - return true; + else if (gimple_call_internal_p (call)) + switch (gimple_call_internal_fn (call)) + { + case IFN_ABNORMAL_DISPATCHER: + return true; + default: + if (gimple_call_flags (call) & ECF_LEAF) + return true; + return false; + } - return false; + tree fndecl = gimple_call_fndecl (call); + if (!fndecl) + return false; + struct cgraph_node *n = cgraph_node::get (fndecl); + if (!n) + return false; + enum availability availability; + n = n->function_symbol (&availability); + if (!n || availability <= AVAIL_INTERPOSABLE) + return false; + return n->nonfreeing_fn; } /* Callback for walk_stmt_load_store_ops. -- cgit v1.1