aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-utils.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-02-11 18:56:02 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2017-02-11 17:56:02 +0000
commitacbbac0444a599e77b59b4d21186c9c2118b9f84 (patch)
tree0efc3420ad98c534a5761346fa3b54636f7219b0 /gcc/ipa-utils.c
parentbc61048a143b10d8efdc50195f2fc949d036ca92 (diff)
downloadgcc-acbbac0444a599e77b59b4d21186c9c2118b9f84.zip
gcc-acbbac0444a599e77b59b4d21186c9c2118b9f84.tar.gz
gcc-acbbac0444a599e77b59b4d21186c9c2118b9f84.tar.bz2
re PR middle-end/56727 (Recursive call goes through the PLT unnecessarily)
PR tree-ssa/56727 * gcc.dg/tree-ssa/pr56727.c: New testcase. * ipa-utils.c (recursive_call_p): Be more careful about interposition. From-SVN: r245359
Diffstat (limited to 'gcc/ipa-utils.c')
-rw-r--r--gcc/ipa-utils.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index fc1ae1e..98a4f11 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -639,6 +639,20 @@ recursive_call_p (tree func, tree dest)
{
struct cgraph_node *dest_node = cgraph_node::get_create (dest);
struct cgraph_node *cnode = cgraph_node::get_create (func);
-
- return dest_node->semantically_equivalent_p (cnode);
+ ipa_ref *alias;
+ enum availability avail;
+
+ gcc_assert (!cnode->alias);
+ if (cnode != dest_node->ultimate_alias_target (&avail))
+ return false;
+ if (avail >= AVAIL_AVAILABLE)
+ return true;
+ if (!dest_node->semantically_equivalent_p (cnode))
+ return false;
+ /* If there is only one way to call the fuction or we know all of them
+ are semantically equivalent, we still can consider call recursive. */
+ FOR_EACH_ALIAS (cnode, alias)
+ if (!dest_node->semantically_equivalent_p (alias->referring))
+ return false;
+ return true;
}