On Saturday 12 November 2005 12:29, Andrew Haley wrote:
> Diego Novillo writes:
>
>  > if (shared_1)
>  >    x_4 = "x"
>  > else
>  >   {
>  >     x_5 = new String("x");
>  >     x_6 = ASSERT_EXPR <x_5, x_5 != 0>
>  >   }
>  > x_7 = PHI <x_4, x_6>
>  >
>  > VRP already knows that "x" is non-NULL.  The new function attribute
>  > will cause VRP to insert the ASSERT_EXPR for x_5.  VRP will
>  > detetermine that x_7 is non-NULL.
>
> OK, so what's to stop the front-end from generating the assertion at
> gimplification time?  Then we don't need any new attributes in the
> middle-end.
>
The FE is not emitting SSA code.  In 'x = new String("x")', it will know 
that 'x' is non-NULL at that point, but it cannot prove that 'x' will 
remain non-NULL everywhere.  When you are in SSA form, x_6 is non-NULL and 
everywhere you see x_6 you are guaranteed to be dealing with a non-NULL 
value.

The helpful hint we need from the FE inside VRP is for it to mark the 
actual call as returning non-NULL.

Reply via email to