Optimize callers using nonnull attribute

Jakub Jelinek jakub@redhat.com
Fri Oct 11 12:54:00 GMT 2013


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



More information about the Gcc-patches mailing list