Null pointer check elimination
Diego Novillo
dnovillo@redhat.com
Sat Nov 12 17:25:00 GMT 2005
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.
More information about the Java
mailing list