public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: gcc-patches@gcc.gnu.org
Cc: amker.cheng@gmail.com,	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/3] Fix autoprofiledbootstrap
Date: Mon, 14 Jan 2019 08:20:00 -0000	[thread overview]
Message-ID: <20190114081942.9088-2-andi@firstfloor.org> (raw)
In-Reply-To: <20190114081942.9088-1-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

autoprofiledbootstrap fails currently with

In file included from ../../gcc/gcc/hash-table.h:236,
                 from ../../gcc/gcc/coretypes.h:440,
                 from ../../gcc/gcc/ipa-devirt.c:110:
In static member function 'static void va_heap::release(vec<T, va_heap, vl_embed>*&) [with T = tree_node*]',
    inlined from 'void vec<T>::release() [with T = tree_node*]' at ../../gcc/gcc/vec.h:1679:20,
    inlined from 'auto_vec<T, N>::~auto_vec() [with T = tree_node*; long unsigned int N = 8]' at ../../gcc/gcc/vec.h:1436:5,
    inlined from 'vec<cgraph_node*> possible_polymorphic_call_targets(tree, long int, ipa_polymorphic_call_context, bool*, void**, bool)' at ../../gcc/gcc/ipa-devirt.c:3099:22:
../../gcc/gcc/vec.h:311:10: error: attempt to free a non-heap object 'bases_to_consider' [-Werror=free-nonheap-object]
  311 |   ::free (v);
      |   ~~~~~~~^~~
../../gcc/gcc/vec.h:311:10: error: attempt to free a non-heap object 'bases_to_consider' [-Werror=free-nonheap-object]
cc1plus: all warnings being treated as errors

The problem is that auto_vec uses a variable to keep track if the vector
is on the heap or auto. Normally this gets constant resolved, but only
when the right functions are inlined. With autofdo for some reason
the compiler decides to not inline these vec functions, even though
they are marked as "inline"

Mark them as ALWAYS_INLINE instead.

gcc/:

2019-01-14  Andi Kleen  <ak@linux.intel.com>

	* vec.h (using_auto_storage, release): Mark as ALWAYS_INLINE.
---
 gcc/vec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/vec.h b/gcc/vec.h
index 407269c5ad3..1f5b78b1fac 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1664,7 +1664,7 @@ vec<T, va_heap, vl_ptr>::create (unsigned nelems MEM_STAT_DECL)
 /* Free the memory occupied by the embedded vector.  */
 
 template<typename T>
-inline void
+ALWAYS_INLINE void
 vec<T, va_heap, vl_ptr>::release (void)
 {
   if (!m_vec)
@@ -1940,7 +1940,7 @@ vec<T, va_heap, vl_ptr>::reverse (void)
 }
 
 template<typename T>
-inline bool
+ALWAYS_INLINE bool
 vec<T, va_heap, vl_ptr>::using_auto_storage () const
 {
   return m_vec->m_vecpfx.m_using_auto_storage;
-- 
2.19.1

  reply	other threads:[~2019-01-14  8:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14  8:20 [PATCH 1/3] Lower sampling rate for autofdo bootstrap Andi Kleen
2019-01-14  8:20 ` Andi Kleen [this message]
2019-01-14  8:20   ` [PATCH 3/3] Increase iterations for autofdo tests Andi Kleen
2019-01-14  9:08     ` Richard Biener
2019-01-14  9:04   ` [PATCH 2/3] Fix autoprofiledbootstrap Richard Biener
2019-01-14  9:11   ` Bin.Cheng
2019-01-14  9:06 ` [PATCH 1/3] Lower sampling rate for autofdo bootstrap Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190114081942.9088-2-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).