This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Remove useless null pointer checks
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: Andrew Haley <aph at redhat dot com>, Jeff Law <law at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: 31 Jul 2003 13:30:42 -0400
- Subject: Re: [tree-ssa] Remove useless null pointer checks
- Organization: Red Hat Canada
- References: <Pine.LNX.4.44.0307311324200.19915-100000@ops2.one-point.com>
On Thu, 2003-07-31 at 13:26, Jeff Sturm wrote:
> On Thu, 31 Jul 2003, Andrew Haley wrote:
> > > Would it be worthwhile to express this in GIMPLE, i.e. NEW_EXPR?
> >
> > But there are many standard library methods that cannot return NULL;
> > they either return an object reference or throw an exception. So
> > NEW_EXPR is too specific.
>
> True, but for java methods the optimizers could learn a lot from the
> trees. As in Jeff's my_malloc example.
>
Still, I'm not sure we really need new tree codes here. Having the
attribute associated with the FUNCTION_DECL should enough to propagate
it into the CALL_EXPR node and ultimately into the FUNCTION_DECL of the
current function (e.g. if the optimizers determine that the function
can't possibly return NULL).
The FE is where the initial seed of CANT_BE_NULL should be placed.
Diego.