This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Optimize callers using nonnull attribute
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 11 Oct 2013 14:50:22 +0200
- Subject: Re: Optimize callers using nonnull attribute
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1310070016540 dot 15069 at stedding dot saclay dot inria dot fr> <CAFiYyc3o9ZYNWgfNOpL6VjD84doj6Mh81USALdRF1N967M5iOA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1310071517260 dot 21427 at stedding dot saclay dot inria dot fr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Oct 07, 2013 at 03:52:25PM +0200, Marc Glisse wrote:
> 2013-10-08 Marc Glisse <marc.glisse@inria.fr>
>
> PR tree-optimization/58480
> gcc/
> * tree-vrp.c (infer_nonnull_range): New function.
> (infer_value_range): Call infer_nonnull_range.
This broke whole bunch of OpenMP tests. Internal calls
have NULL gimple_call_fntype.
Fixed thusly, committed as obvious to trunk.
OT, do you plan to define ATTRIBUTE_RETURNS_NONNULL for
GCC_VERSION >= 4009 in ansidecl.h and use it on the various xmalloc
etc. prototypes?
2013-10-11 Jakub Jelinek <jakub@redhat.com>
* tree-vrp.c (infer_nonnull_range): Use is_gimple_call,
ignore internal calls.
--- gcc/tree-vrp.c.jj 2013-10-10 18:28:15.000000000 +0200
+++ gcc/tree-vrp.c 2013-10-11 14:41:22.625280236 +0200
@@ -4484,7 +4484,7 @@ infer_nonnull_range (gimple stmt, tree o
if (num_loads + num_stores > 0)
return true;
- if (gimple_code (stmt) == GIMPLE_CALL)
+ if (is_gimple_call (stmt) && !gimple_call_internal_p (stmt))
{
tree fntype = gimple_call_fntype (stmt);
tree attrs = TYPE_ATTRIBUTES (fntype);
Jakub