public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/50346] Function call foils VRP/jump-threading of redundant predicate on struct member
Date: Mon, 12 Mar 2012 08:57:00 -0000	[thread overview]
Message-ID: <bug-50346-4-4ScrsFozDh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50346-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> 2012-03-12 08:56:40 UTC ---
On Wed, 7 Mar 2012, scovich at gmail dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50346
> 
> --- Comment #8 from Ryan Johnson <scovich at gmail dot com> 2012-03-07 14:28:29 UTC ---
> (In reply to comment #7)
> > On Wed, 7 Mar 2012, scovich at gmail dot com wrote:
> > 
> > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50346
> > > 
> > > --- Comment #6 from Ryan Johnson <scovich at gmail dot com> 2012-03-07 13:31:19 UTC ---
> > > (In reply to comment #5)
> > > > On Wed, 12 Oct 2011, scovich at gmail dot com wrote:
> > > > 
> > > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50346
> > > > > 
> > > > > --- Comment #4 from Ryan Johnson <scovich at gmail dot com> 2011-10-12 12:40:25 UTC ---
> > > > > (In reply to comment #3)
> > > > > > Well, it's a tree optimization issue.  It's simple - the local aggregate f
> > > > > > escapes the function via the member function call to baz:
> > > > > > 
> > > > > > <bb 5>:
> > > > > >   foo::baz (&f);
> > > > > > 
> > > > > > and as our points-to analysis is not flow-sensitive for memory/calls this
> > > > > > causes f to be clobbered by the call to bar
> > > > > 
> > > > > Is flow-sensitive analysis within single functions prohibitively expensive? All
> > > > > the papers I can find talk about whole-program analysis, where it's very
> > > > > expensive in both time and space; the best I could find (CGO'11 best paper)
> > > > > gets it down to 20-30ms and 2-3MB per kLoC for up to ~300kLoC. 
> > > > 
> > > > It would need a complete rewrite, it isn't integratable into the current
> > > > solver (which happens to be shared between IPA and non-IPA modes).
> > > That makes sense...
> > > 
> > > Wild idea: would it be possible to annotate references as "escaped" or "not
> > > escaped yet" ? Anything global or passed into the function would be marked as
> > > escaped, while anything allocated locally would start out as not escaped;
> > > assigning to an escaped location or passing to a function would mark it as
> > > escaped if it wasn't already. The status could be determined in linear time
> > > using local information only (= scalable), and would benefit strongly as
> > > inlining (IPA or not) eliminates escape points.
> > 
> > Well, you can compute the clobber/use sets of individual function calls,
> > IPA PTA computes a simple mod-ref analysis this way.  You can also
> > annotate functions whether they make arguments escape or whether it
> > reads from them or clobbers them.
> > 
> > The plan is to do some simple analysis and propagate that up the
> > callgraph, similar to pure-const analysis.  The escape part could
> > be integrated there.
> 
> That sounds really slick to have in general... but would it actually catch the
> test case above? What you describe seems to depend on test() having information
> about foo::baz() -- which it does not -- while analyzing the body of test()
> could at least identify the part of f's lifetime where it cannot possibly have
> escaped.
> 
> Or does the local analysis come "for free" once those IPA changes are in place?

No, the local analysis is what makes the IPA changes "free" ;)  Of course
the local analysis would need to be flow sensitive.

Richard.


  parent reply	other threads:[~2012-03-12  8:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-10  8:23 [Bug c++/50346] New: " scovich at gmail dot com
2011-09-10 13:53 ` [Bug c++/50346] " steven at gcc dot gnu.org
2011-10-11 23:51 ` paolo.carlini at oracle dot com
2011-10-12 10:10 ` [Bug tree-optimization/50346] " rguenth at gcc dot gnu.org
2011-10-12 12:41 ` scovich at gmail dot com
2011-10-12 12:44 ` rguenther at suse dot de
2012-03-07 13:31 ` scovich at gmail dot com
2012-03-07 13:40 ` rguenther at suse dot de
2012-03-07 14:29 ` scovich at gmail dot com
2012-03-12  8:57 ` rguenther at suse dot de [this message]
2021-08-11  4:31 ` pinskia at gcc dot gnu.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=bug-50346-4-4ScrsFozDh@http.gcc.gnu.org/bugzilla/ \
    --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).