public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: RFA: New pass to delete unexecutable paths in the CFG
Date: Tue, 08 Nov 2011 19:48:00 -0000	[thread overview]
Message-ID: <4EB98316.2080803@redhat.com> (raw)
In-Reply-To: <j9b35s$vnb$1@dough.gmane.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/08/11 04:18, Paolo Bonzini wrote:
> On 11/07/2011 07:54 PM, Jeff Law wrote:
>> But we're still stuck with the conditional leading to the path
>> with the __builtin_trap.  That's what we want to avoid since
>> those conditionals are executed at runtime.
> 
> Just to understand, what does this do with your optimization?
> 
> void f(void *p) { if (p) { puts("sell_soul_to_devil"); 
> puts("post_reload_rewrite"); }
> 
> *p = 2; }
> 
> ... f(NULL);
> 
> Does the program sell its soul to the devil before crashing?
If "f" is not inlined into its caller, then there's nothing for the
new pass to do.  There's no explicit NULL dereference and there's no
assignments to "p", so there's no PHI at the merge point for P.


If f is inlined into the caller, exposing NULL as a value for P, we'd have

if (0)
  {
    whatever
  }

 *0 = 2;

The conditional would be removed leaving just


  *0 = 2

To know the effect, we'd have to have more context of the caller.

If the caller was just

void bar ()
{
  f (NULL);
}

*0 = 2 is not control dependent on any path and thus it'd be left alone.



Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOuYMWAAoJEBRtltQi2kC7HxoH/3tJIsoGp0qha3ys48M/tszg
zsVatm9mN6QiloU64UmpnUTdiBIgU66DcWUKkwqwmi+v1tdYr+OkhyrdrRvW4OQh
A6XsQnMnyw7jO2IEqqvB25blNEXR+qCTqwmyMI1dQXg0dJEhnLVuxI05Z1waD/Q9
bs7UbQqvpIYQSZwAB+22Bre2VR944l0O6FG1rWcVWmHdDFTgM8NdTr3gnuPLkev3
8/9ekkHiiOuBgmg60PVyax6NqBoiLtt3KAodVB5wUrq2rVhrjDwr9FIKsg4oe6dO
DdkZhs5h6kAkLZ9D/yv8ZLkqn/P6j3jlhVYIMe7/YbBc0Ae8cn9gpYtK0vfmirk=
=AUFy
-----END PGP SIGNATURE-----

  reply	other threads:[~2011-11-08 19:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07  9:58 Jeff Law
2011-11-07 10:19 ` Jakub Jelinek
2011-11-07 10:21   ` Richard Guenther
2011-11-07 10:30     ` Richard Guenther
2011-11-07 19:20       ` Jeff Law
2011-11-07 16:14     ` Jeff Law
2011-11-07 16:30       ` Richard Guenther
2011-11-07 16:57         ` Kai Tietz
2011-11-07 19:03         ` Jeff Law
2011-11-08 11:50           ` Paolo Bonzini
2011-11-08 19:48             ` Jeff Law [this message]
2011-11-08 20:38               ` Paolo Bonzini
2011-11-08 20:59                 ` Jeff Law
2011-11-09  8:37                   ` Paolo Bonzini
2011-11-09 18:11                     ` Jeff Law
2011-11-09 18:12                       ` Jakub Jelinek
2011-11-09 22:45                       ` Paolo Bonzini
2011-11-10 19:27                         ` Jeff Law
2011-11-07 19:14   ` Jeff Law
2011-11-07 14:16 ` Tom Tromey
2011-11-07 15:54   ` Jeff Law
2011-11-07 15:54     ` Richard Guenther
2011-11-07 19:09       ` Jeff Law
2011-11-07 22:34         ` Richard Guenther
2011-11-08 20:02           ` Jeff Law
2011-11-09  9:50             ` Richard Guenther
2011-11-09 17:43               ` Jeff Law
2011-11-07 15:55     ` Tom Tromey
2011-11-07 17:01       ` Paolo Bonzini
2011-11-15  7:52         ` RFA: disable -fdelete-null-pointer-checks for Java Jeff Law
2011-11-07 19:05       ` RFA: New pass to delete unexecutable paths in the CFG Jeff Law

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=4EB98316.2080803@redhat.com \
    --to=law@redhat.com \
    --cc=bonzini@gnu.org \
    --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).