This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Null pointer check elimination


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]