This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Serious performance regression -- some tree optimizer questions


Hi,

Zdenek Dvorak wrote:
> *************** chrec_fold_multiply (tree type, 
> *** 330,335 ****
> --- 298,306 ----
>   		     tree op0,
>   		     tree op1)
>   {
> +   tree chrec;
> +   bool no_overflow;
> + 
>     if (automatically_generated_chrec_p (op0)
>         || automatically_generated_chrec_p (op1))
>       return chrec_fold_automatically_generated_operands (op0, op1);
> *************** chrec_fold_multiply (tree type, 
> *** 348,357 ****
>   	  if (integer_zerop (op1))
>   	    return build_int_cst_type (type, 0);
>   	  
> ! 	  return build_polynomial_chrec 
> ! 	    (CHREC_VARIABLE (op0), 
> ! 	     chrec_fold_multiply (type, CHREC_LEFT (op0), op1),
> ! 	     chrec_fold_multiply (type, CHREC_RIGHT (op0), op1));
>   	}
>         
>       default:
> --- 319,334 ----
>   	  if (integer_zerop (op1))
>   	    return build_int_cst_type (type, 0);
>   	  
> ! 	  no_overflow = (TYPE_ARITH_NO_OVERFLOW (type)
> ! 			 && CHREC_NO_OVERFLOW (op0));
> ! 
> ! 	  chrec = build_polynomial_chrec 
> ! 		  (CHREC_VARIABLE (op0), 
> ! 		   chrec_fold_multiply (type, CHREC_LEFT (op0), op1),
> ! 		   chrec_fold_multiply (type, CHREC_RIGHT (op0), op1));
> ! 	  CHREC_NO_OVERFLOW (chrec) = true;

In this case you have to set CHREC_NO_OVERFLOW (chrec) to no_overflow,
and not directly to true.

> ! 
> ! 	  return chrec;
>   	}
>         
>       default:
> *************** chrec_fold_multiply (tree type, 
> *** 364,373 ****
>         switch (TREE_CODE (op1))
>   	{
>   	case POLYNOMIAL_CHREC:
> ! 	  return build_polynomial_chrec 
> ! 	    (CHREC_VARIABLE (op1), 
> ! 	     chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
> ! 	     chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
>   	  
>   	default:
>   	  if (integer_onep (op1))
> --- 341,356 ----
>         switch (TREE_CODE (op1))
>   	{
>   	case POLYNOMIAL_CHREC:
> ! 	  no_overflow = (TYPE_ARITH_NO_OVERFLOW (type)
> ! 			 && CHREC_NO_OVERFLOW (op1));
> ! 
> ! 	  chrec = build_polynomial_chrec 
> ! 		  (CHREC_VARIABLE (op1), 
> ! 		   chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
> ! 		   chrec_fold_multiply (type, CHREC_RIGHT (op1), op0));
> ! 	  CHREC_NO_OVERFLOW (chrec) = true;

Same here.

> ! 
> ! 	  return chrec;
>   	  
>   	default:
>   	  if (integer_onep (op1))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]