-----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 via email to