[PATCH] Fix PR70457 (ICE on incompatible call to built-in pow)

Bill Schmidt wschmidt@linux.vnet.ibm.com
Mon Apr 4 12:17:00 GMT 2016


OK, sorry for misreading the note.  This is exactly what I've done for
the GCC 5 and GCC 4.9 versions, so I'll update the GCC 6 version to do
the same.

Bill

On Mon, 2016-04-04 at 08:57 +0200, Jakub Jelinek wrote:
> On Sun, Apr 03, 2016 at 06:43:47PM -0500, Bill Schmidt wrote:
> > --- tree-inline.c	(revision 234702)
> > +++ tree-inline.c	(working copy)
> > @@ -57,8 +57,8 @@ along with GCC; see the file COPYING3.  If not see
> >  #include "cfgloop.h"
> >  #include "builtins.h"
> >  #include "tree-chkp.h"
> > +#include "case-cfn-macros.h"
> >  
> > -
> >  /* I'm not real happy about this, but we need to handle gimple and
> >     non-gimple trees.  */
> >  
> 
> Please keep the extra empty line above.
> 
> > @@ -4070,11 +4070,9 @@ estimate_num_insns (gimple *stmt, eni_weights *wei
> >  		/* We canonicalize x * x to pow (x, 2.0) with -ffast-math, so
> >  		   specialize the cheap expansion we do here.
> >  		   ???  This asks for a more general solution.  */
> > -		switch (DECL_FUNCTION_CODE (decl))
> > +		switch (gimple_call_combined_fn (stmt))
> >  		  {
> > -		    case BUILT_IN_POW:
> > -		    case BUILT_IN_POWF:
> > -		    case BUILT_IN_POWL:
> > +  		    CASE_CFN_POW:
> >  		      if (TREE_CODE (gimple_call_arg (stmt, 1)) == REAL_CST
> >  			  && (real_equal
> >  			      (&TREE_REAL_CST (gimple_call_arg (stmt, 1)),
> 
> Actually, I haven't been suggesting to use gimple_call_combined_fn,
> but gimple_call_builtin_p.
> Here using gimple_call_combined_fn doesn't make much sense, because
> it is in code guarded with:
>         if (gimple_call_internal_p (stmt))
>           return 0;
>         else if ((decl = gimple_call_fndecl (stmt))
>                  && DECL_BUILT_IN (decl))
>           {
> ...
>             else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
>               {
> Thus, internal functions don't make this spot at all.
> So, either replace the DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
> with gimple_builtin_call_p (stmt, BUILT_IN_NORMAL); or call
> gimple_builtin_call_types_compatible_p.
> 
> > Index: tree-ssa-math-opts.c
> > ===================================================================
> > --- tree-ssa-math-opts.c	(revision 234702)
> > +++ tree-ssa-math-opts.c	(working copy)
> > @@ -3829,11 +3829,9 @@ pass_optimize_widening_mul::execute (function *fun
> >  	      if (fndecl
> >  		  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
> >  		{
> > -		  switch (DECL_FUNCTION_CODE (fndecl))
> > +		  switch (gimple_call_combined_fn (stmt))
> >  		    {
> > -		      case BUILT_IN_POWF:
> > -		      case BUILT_IN_POW:
> > -		      case BUILT_IN_POWL:
> > +		      CASE_CFN_POW:
> >  			if (TREE_CODE (gimple_call_arg (stmt, 1)) == REAL_CST
> >  			    && real_equal
> >  			         (&TREE_REAL_CST (gimple_call_arg (stmt, 1)),
> > 
> 
> And similarly here.
> 
> 	Jakub
> 




More information about the Gcc-patches mailing list