[PATCH] Fix PR38819, PREing of trapping expressions

Paolo Bonzini bonzini@gnu.org
Sat Jan 17 10:51:00 GMT 2009


> +       if (eprime->kind == NAME
> + 	  || eprime->kind == CONSTANT
> + 	  || eprime->kind == REFERENCE)
> + 	continue;
> +       nary = PRE_EXPR_NARY (eprime);
> +       if (TREE_CODE_CLASS (nary->opcode) == tcc_comparison
> + 	  || TREE_CODE_CLASS (nary->opcode) == tcc_unary
> + 	  || TREE_CODE_CLASS (nary->opcode) == tcc_binary)
> + 	{
> + 	  type = nary->type;
> + 	  fp_operation = FLOAT_TYPE_P (type);
> + 	  if (fp_operation)
> + 	    {
> + 	      honor_nans = flag_trapping_math && !flag_finite_math_only;
> + 	      honor_snans = flag_signaling_nans != 0;
> + 	    }
> + 	  else if (INTEGRAL_TYPE_P (type)
> + 		   && TYPE_OVERFLOW_TRAPS (type))
> + 	    honor_trapv = true;
> + 	}
> +       rhs2 = nary->op[1];
> +       ret = operation_could_trap_helper_p (nary->opcode, fp_operation,
> + 					   honor_trapv,
> + 					   honor_nans, honor_snans, rhs2,
> + 					   &handled);
> +       if (handled
> + 	  && ret)
> + 	return false;
> + 
> +       for (i = 0; i < nary->length; ++i)
> + 	if (tree_could_trap_p (nary->op[i]))
> + 	  return false;

Extract to vn_could_trap_p?

This would change the patch basically to the much more readable

    FOR_EACH_EDGE (pred, ei, block->preds)
      if (vn_could_trap_p (avail[pred->src->index]))
	return false;

Paolo



More information about the Gcc-patches mailing list