public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jh at suse dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/13768] [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function
Date: Tue, 03 Feb 2004 15:59:00 -0000	[thread overview]
Message-ID: <20040203155936.30956.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040120110040.13768.igodard@pacbell.net>


------- Additional Comments From jh at suse dot cz  2004-02-03 15:59 -------
Subject: Re:  [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function

> 
> ------- Additional Comments From jh at suse dot cz  2004-02-03 15:53 -------
> Subject: Re:  [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function
> 
> > 
> > ------- Additional Comments From mark at codesourcery dot com  2004-02-03 15:46 -------
> > Subject: Re:  [3.4/3.5 Regression] -funit-at-a-time compiles
> >  unused inline function
> > 
> > hubicka at ucw dot cz wrote:
> > 
> > >------- Additional Comments From hubicka at ucw dot cz  2004-02-03 11:00 -------
> > >Subject: Re:  [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function
> > >
> > >  
> > >
> > >>------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-03 09:25 -------
> > >>The code is indeed invalid.
> > >>
> > >>When a complete object of type X<int> is created, the compiler is allowed to
> > >>emit the vtable for X, and that permits instantiating the virtual functions.
> > >>
> > >>However, this is an optimization deficiency in -funit-at-a-time.
> > >>    
> > >>
> > >
> > >Yes, the problem is that all dependencies are resolved before
> > >optimization is done.  I am planning to address this by doing early pass
> > >of tree-ssa optimization before inlining and cgraph construction.  That
> > >way we should catch majority of cases.
> > >I also plan to deffer output of datastrctures to the very end of
> > >compilation and use information about what was really used by backend.
> > >
> > >Honza
> > >
> > What do you suggest, if anything, for GCC 3.4?
> > 
> > (This is potentially a regression with respect to the size of the 
> > generated code.  There is lots of code with trivial constructors that, 
> > after inlining, will be eliminated.)
> 
> I think we can keep it as it is now.  I did quite huge amount of
> measuring and the unit-at-a-time is a win for majority of C++ programs,
> so I think the other benefits outweight it.
> It is quite dificult to solve with current framework, unforutnately,
> since we discover such facts only during RTL expansion pass and because
> we mix analysis and optimization, we want to order things in a way so
> calees are compiled first and thus we can't take them back.  My CFG
> transparent expansion/inlining project is all about getting this
> chicken-egg problem broken up.
> 
> Note that if the constructor get inlined to all call sites, it's out of
> line copy will be elliminated.  We only lose in the case the
> constructor is not inlined for whatever reason and then the call site is
> removed later, for instance because the code turns out to be dead.  This
> don't seems to be terribly common in real code from what I've seen.
> 
> Another problem is that we don't have ability to elliminate static
> cosntructors when static variable turns out to be unnecesary.  Richard
> did some work on this, but didn't finished it, I plan to look into it
> after tree-SSA merge.

Actually looking deeper into this specific testcase,  I believe that if
the source program was correct, unit-at-a-time would emit empty file
too, since there is no entry point from where the call in question can
be reached, so it just builds the program representation in memory prior
optimizing it.
This is because of your request to change C++ frontend that way (my
initial patch didn't force instantiation of all TREE_USED templates).

I think this is correct thing - GCC should error out on this testcase.
Why it is considered a bug at first place?

Honza
> 
> Honza
> > 
> > 
> > 
> > -- 
> > 
> > 
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13768
> > 
> > ------- You are receiving this mail because: -------
> > You are the assignee for the bug, or are watching the assignee.
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13768
> 
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13768


  parent reply	other threads:[~2004-02-03 15:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-20 11:00 [Bug c++/13768] New: syntax error only when -O2 igodard at pacbell dot net
2004-01-20 11:01 ` [Bug c++/13768] " igodard at pacbell dot net
2004-01-20 11:02 ` igodard at pacbell dot net
2004-01-20 11:03 ` igodard at pacbell dot net
2004-01-20 11:05 ` igodard at pacbell dot net
2004-01-20 15:49 ` [Bug c++/13768] [3.4/3.5 Regression] syntax error only when -funit-at-a-time pinskia at gcc dot gnu dot org
2004-01-20 17:18 ` [Bug optimization/13768] [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function bangerth at dealii dot org
2004-01-21  3:26 ` pinskia at gcc dot gnu dot org
2004-01-21  5:22 ` igodard at pacbell dot net
2004-01-21  7:44 ` pinskia at gcc dot gnu dot org
2004-01-21 13:37 ` bangerth at dealii dot org
2004-01-31 18:22 ` pinskia at gcc dot gnu dot org
2004-02-03  8:39 ` [Bug c++/13768] " ebotcazou at gcc dot gnu dot org
2004-02-03  9:25 ` mmitchel at gcc dot gnu dot org
2004-02-03 11:00 ` hubicka at ucw dot cz
2004-02-03 15:46 ` mark at codesourcery dot com
2004-02-03 15:53 ` jh at suse dot cz
2004-02-03 15:59 ` jh at suse dot cz [this message]
2004-02-03 16:02 ` mmitchel at gcc dot gnu dot org
2004-02-03 16:04 ` hubicka at ucw dot cz
2004-02-03 17:22 ` mark at codesourcery dot com
2004-02-05 17:14 ` [Bug c++/13768] C++ fails to diagnose invalid code pinskia at gcc dot gnu dot org
2004-02-05 17:23 ` [Bug c++/13768] C++ fails to diagnose invalid code(calling a non exitsing function in a template class) in non unit-at-a-time mode giovannibajo at libero dot it
2004-02-05 20:04 ` [Bug c++/13768] Incoherent behaviour in instantiation between -funit-at-a-time and -fno-unit-at-a-time igodard at pacbell dot net
2004-05-05 20:25 ` hubicka at gcc dot gnu dot org
2004-08-03  6:03 ` pinskia at gcc dot gnu dot org

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=20040203155936.30956.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).