Diego Novillo writes:
> On Saturday 12 November 2005 12:19, Andrew Haley wrote:
>
> > Couldn't we attach an assertion to the tree? That way we could just
> > use the inference logic we already have.
> >
> We already do that. In Per's test case,
>
> String x = shared ? "x" : new String("x");
>
> we get into VRP with an SSA form along these lines:
>
> 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.
Andrew.