public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gil.hur at sf dot snu.ac.kr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/65752] Too strong optimizations int -> pointer casts
Date: Tue, 26 May 2015 14:06:00 -0000	[thread overview]
Message-ID: <bug-65752-4-G1bE5Kb1yQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65752-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752

--- Comment #37 from Chung-Kil Hur <gil.hur at sf dot snu.ac.kr> ---
(In reply to rguenther@suse.de from comment #36)
> On Tue, 26 May 2015, gil.hur at sf dot snu.ac.kr wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
> > 
> > --- Comment #35 from Chung-Kil Hur <gil.hur at sf dot snu.ac.kr> ---
> > (In reply to rguenther@suse.de from comment #34)
> > > On Sat, 23 May 2015, gil.hur at sf dot snu.ac.kr wrote:
> > > 
> > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
> > > > 
> > > > --- Comment #33 from Chung-Kil Hur <gil.hur at sf dot snu.ac.kr> ---
> > > > Dear Richard,
> > > > 
> > > > Thanks for the detailed response.
> > > > 
> > > > I have a suggestion for a solution of the problem, which is based on my paper
> > > > to appear at PLDI 2015.
> > > > 
> > > > * A Formal C Memory Model Supporting Integer-Pointer Casts.
> > > >   Jeehoon Kang, Chung-Kil Hur, William Mansky, Dmitri Garbuzov, Steve
> > > > Zdancewic, Viktor Vafeiadis.
> > > >   http://sf.snu.ac.kr/gil.hur/publications/intptrcast.pdf
> > > > 
> > > > The suggestion is simple.
> > > > You do not need to turn off the phiopt optimizations.
> > > > We propose to slightly change the following assumption.
> > > > 
> > > > > PTA considers that all pointers coming from integer constants
> > > > > point to global memory only.
> > > > 
> > > > Here, if you change this as follows, you can solve the problem.
> > > > 
> > > > * All pointers coming from integer constants can point to only global memory
> > > > and
> > > >   local variables whose addresses have been cast to integers.
> > > 
> > > Ok, so you basically add a 2nd class of "escaping".  So in GCC PTA
> > > terms you'd add a new ESCAPE-like 'INTEGER' variable with
> > > 
> > > INTEGER = NONLOCAL
> > > 
> > > and add
> > > 
> > > INTEGER = x
> > > 
> > > constraints for each
> > > 
> > > .. = (integer-type) &x
> > > 
> > > conversion and for the reverse
> > > 
> > >  ptr = (pointer-type) i
> > > 
> > > add
> > > 
> > > ptr = INTEGER
> > > 
> > > > Also, we expect that this would not decrease the optimization performance of
> > > > GCC very much because those variables whose addresses have been cast to
> > > > integers tend to be escaped (e.g. passed to a hash function, or stored in the
> > > > memory).
> > > 
> > > Well - the above basically makes _all_ pointers converted from integers
> > > point to non-local memory, it also basically globs all pointers
> > > converted from integers into a single equivalence class.
> > 
> > Yes, this is right.
> > 
> > > So I think you underestimate the effect on optimization (but I may
> > > overestimate the effect on optimization of not simply making all
> > > pointers converted from integers point to all globals and all
> > > address-taken locals, aka ANYTHING in GCC PTA terms)
> > 
> > Just one minor correction:
> > all address-taken locals -> all address-taken-and-cast-to-integer locals
> > 
> > Yes, I agree. 
> > In order to understand the effect, we need some empirical evidence.
> > I am interested in this direction.
> > So, I wonder what benchmarks you usually use to check the effect of compiler
> > optimizations.
> > More specifically, are SPEC benchmarks enough? or do you use some other
> > benchmarks too?
> 
> SPEC CPU tends to capture most of this though we also periodically
> check other "benchmarks" such as firefox and its few performance
> tests or similar big C++ programs.

Thanks for the information!


  parent reply	other threads:[~2015-05-26 14:06 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 14:04 [Bug c/65752] New: " gcc at robbertkrebbers dot nl
2015-04-13 17:38 ` [Bug c/65752] " joseph at codesourcery dot com
2015-04-13 23:25 ` gcc at robbertkrebbers dot nl
2015-04-13 23:25 ` gcc at robbertkrebbers dot nl
2015-04-14  8:39 ` rguenth at gcc dot gnu.org
2015-04-14  8:46 ` gcc at robbertkrebbers dot nl
2015-04-14  9:01 ` rguenth at gcc dot gnu.org
2015-04-14  9:06 ` rguenth at gcc dot gnu.org
2015-04-14  9:23 ` gcc at robbertkrebbers dot nl
2015-04-14  9:26 ` gcc at robbertkrebbers dot nl
2015-04-14 10:50 ` rguenth at gcc dot gnu.org
2015-04-20 13:45 ` [Bug tree-optimization/65752] " mpolacek at gcc dot gnu.org
2015-04-20 13:53 ` gcc at robbertkrebbers dot nl
2015-05-18 17:13 ` gil.hur at sf dot snu.ac.kr
2015-05-19  9:21 ` rguenth at gcc dot gnu.org
2015-05-19 12:08 ` gil.hur at sf dot snu.ac.kr
2015-05-19 12:33 ` rguenth at gcc dot gnu.org
2015-05-19 13:14 ` gil.hur at sf dot snu.ac.kr
2015-05-19 14:21 ` rguenther at suse dot de
2015-05-19 14:29 ` gil.hur at sf dot snu.ac.kr
2015-05-19 14:32 ` mpolacek at gcc dot gnu.org
2015-05-19 15:12 ` gil.hur at sf dot snu.ac.kr
2015-05-19 15:23   ` Andreas Schwab
2015-05-19 15:23 ` schwab at suse dot de
2015-05-19 15:29 ` gil.hur at sf dot snu.ac.kr
2015-05-20  8:01 ` rguenth at gcc dot gnu.org
2015-05-20 10:55 ` gil.hur at sf dot snu.ac.kr
2015-05-20 11:20 ` gil.hur at sf dot snu.ac.kr
2015-05-20 11:33 ` rguenther at suse dot de
2015-05-22  4:55 ` mail at robbertkrebbers dot nl
2015-05-22  4:57 ` gcc at robbertkrebbers dot nl
2015-05-22  8:52 ` rguenth at gcc dot gnu.org
2015-05-23  8:14 ` gil.hur at sf dot snu.ac.kr
2015-05-26 11:26 ` rguenther at suse dot de
2015-05-26 13:55 ` gil.hur at sf dot snu.ac.kr
2015-05-26 14:00 ` rguenther at suse dot de
2015-05-26 14:06 ` gil.hur at sf dot snu.ac.kr [this message]
2020-08-04 21:31 ` tavianator at gmail dot com
2020-08-05  7:07 ` rguenther at suse dot de

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-65752-4-G1bE5Kb1yQ@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).