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: law at redhat dot com
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Jul 2003 21:18:55 -0600
- Subject: Re: [tree-ssa] Remove useless null pointer checks
- Reply-to: law at redhat dot com
In message <Pine.LNX.4.44.0307302249500.32603-100000@ops2.one-point.com>, Jeff
Sturm writes:
>This is excellent. Java emits tons of useless null pointer checks.
Yup. I know.
[ ... ]
>Somehow the RTL optimizers never caught on to this.
Odd. We've got a pass do do this at the RTL level and from the structure
of your code I'd expect it to remove the useless check. Very odd.
In fact, the RTL optimizer catches cases that we currently do not
(see 20030730-2.c). However, once we deal with the NOP_EXPR issues
in a sane way I'd expect the tree version to be as or more effective
than the RTL version (not to mention more efficient).
>A related question came up just the other day on the java list. There are
>often-called functions (e.g. allocators) in libgcj that cannot return
>null. Is there a good way to tell the tree optimizers about these, to
>eliminate even more useless null pointer checks?
I don't know.
jeff