public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH AutoFDO/1]Avoid infinite recursion for inlined function decl tracing
@ 2018-10-31  8:10 bin.cheng
  2018-10-31  9:40 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: bin.cheng @ 2018-10-31  8:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

Hi,
This simple patch avoids infinite recursion when tracing inlined function decl by using
pre-defined macro DECL_FROM_INLINE in tree.h.

Bootstrap and test on x86_64 in patch set.  Is it OK?

Thanks,
bin

2018-10-31  Bin Cheng  <bin.cheng@linux.alibaba.com>

	* auto-profile.c (string_table::get_index_by_decl)
	(function_instance::get_function_instance_by_decl): Avoid infinite
	recursion by using DECL_FROM_INLINE.

[-- Attachment #2: 0001-Avoid-infinite-recursion-at-self-DECL_ABSTRACT_ORIGI.patch --]
[-- Type: application/octet-stream, Size: 1148 bytes --]

From 8891512011c8768906d85a45b34c398e69648354 Mon Sep 17 00:00:00 2001
From: chengbin <bin.cheng@linux.alibaba.com>
Date: Thu, 16 Aug 2018 12:07:36 +0800
Subject: [PATCH 1/4] Avoid infinite recursion at self DECL_ABSTRACT_ORIGIN.

---
 gcc/auto-profile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index f7ba32c30ac..9316f4c477b 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -470,7 +470,7 @@ string_table::get_index_by_decl (tree decl) const
   ret = get_index (lang_hooks.dwarf_name (decl, 0));
   if (ret != -1)
     return ret;
-  if (DECL_ABSTRACT_ORIGIN (decl) && DECL_ABSTRACT_ORIGIN (decl) != decl)
+  if (DECL_FROM_INLINE (decl))
     return get_index_by_decl (DECL_ABSTRACT_ORIGIN (decl));
 
   return -1;
@@ -537,7 +537,7 @@ function_instance::get_function_instance_by_decl (unsigned lineno,
       if (ret != callsites.end ())
         return ret->second;
     }
-  if (DECL_ABSTRACT_ORIGIN (decl))
+  if (DECL_FROM_INLINE (decl))
     return get_function_instance_by_decl (lineno, DECL_ABSTRACT_ORIGIN (decl));
 
   return NULL;
-- 
2.14.4.44.g2045bb6


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH AutoFDO/1]Avoid infinite recursion for inlined function decl tracing
  2018-10-31  8:10 [PATCH AutoFDO/1]Avoid infinite recursion for inlined function decl tracing bin.cheng
@ 2018-10-31  9:40 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-10-31  9:40 UTC (permalink / raw)
  To: bin.cheng; +Cc: GCC Patches

On Wed, Oct 31, 2018 at 7:27 AM bin.cheng <bin.cheng@linux.alibaba.com> wrote:
>
> Hi,
> This simple patch avoids infinite recursion when tracing inlined function decl by using
> pre-defined macro DECL_FROM_INLINE in tree.h.
>
> Bootstrap and test on x86_64 in patch set.  Is it OK?

OK.

Richard.

> Thanks,
> bin
>
> 2018-10-31  Bin Cheng  <bin.cheng@linux.alibaba.com>
>
>         * auto-profile.c (string_table::get_index_by_decl)
>         (function_instance::get_function_instance_by_decl): Avoid infinite
>         recursion by using DECL_FROM_INLINE.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-31  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  8:10 [PATCH AutoFDO/1]Avoid infinite recursion for inlined function decl tracing bin.cheng
2018-10-31  9:40 ` Richard Biener

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).