* Fix ipa-devirt-11.C on AIX part 2
@ 2013-09-06 10:20 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2013-09-06 10:20 UTC (permalink / raw)
To: gcc-patches
Hi,
this patch makes tree-sra to do its job in the case where function has an alias.
There were two problems; first recursion is not detected correctly and second
we did not see the callers and thus skipped the function. Rest of tree-sra seems
to work as expected.
Bootstrapped/regtsted x86_64-linux, comitted.
Honza
* Makefile.in (tree-sra.o): Update dependencies.
* tree-sra.c: Include ipa-utils.h
(scan_function): Use recursive_call_p.
(has_caller_p): New function.
(cgraph_for_node_and_aliases): Count also callers of aliases.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 202316)
+++ Makefile.in (working copy)
@@ -3104,7 +3104,7 @@ tree-sra.o : tree-sra.c $(CONFIG_H) $(SY
$(HASH_TABLE_H) $(TM_H) $(TREE_H) $(GIMPLE_H) $(CGRAPH_H) $(TREE_FLOW_H) \
$(IPA_PROP_H) $(DIAGNOSTIC_H) statistics.h \
$(PARAMS_H) $(TARGET_H) $(FLAGS_H) \
- $(DBGCNT_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H)
+ $(DBGCNT_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H) ipa-utils.h
tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
$(TM_H) coretypes.h $(GIMPLE_H) $(CFGLOOP_H) \
Index: tree-sra.c
===================================================================
--- tree-sra.c (revision 202315)
+++ tree-sra.c (working copy)
@@ -91,6 +91,7 @@ along with GCC; see the file COPYING3.
#include "tree-inline.h"
#include "gimple-pretty-print.h"
#include "ipa-inline.h"
+#include "ipa-utils.h"
/* Enumeration of all aggregate reductions we can do. */
enum sra_mode { SRA_MODE_EARLY_IPA, /* early call regularization */
@@ -1256,8 +1257,7 @@ scan_function (void)
if (DECL_BUILT_IN_CLASS (dest) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (dest) == BUILT_IN_APPLY_ARGS)
encountered_apply_args = true;
- if (cgraph_get_node (dest)
- == cgraph_get_node (current_function_decl))
+ if (recursive_call_p (current_function_decl, dest))
{
encountered_recursive_call = true;
if (!callsite_has_enough_arguments_p (stmt))
@@ -4906,6 +4906,16 @@ modify_function (struct cgraph_node *nod
return cfg_changed;
}
+/* If NODE has a caller, return true. */
+
+static bool
+has_caller_p (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+{
+ if (node->callers)
+ return true;
+ return false;
+}
+
/* Return false the function is apparently unsuitable for IPA-SRA based on it's
attributes, return true otherwise. NODE is the cgraph node of the current
function. */
@@ -4949,7 +4959,7 @@ ipa_sra_preliminary_function_checks (str
return false;
}
- if (!node->callers)
+ if (!cgraph_for_node_and_aliases (node, has_caller_p, NULL, true))
{
if (dump_file)
fprintf (dump_file,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-09-06 10:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 10:20 Fix ipa-devirt-11.C on AIX part 2 Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).