CCP propagating conditional expression constants

Richard Guenther richard.guenther@gmail.com
Fri Jan 5 12:11:00 GMT 2007


On 1/5/07, Sebastian Pop <sebastian.pop@inria.fr> wrote:
> Hi,
> here is a patch on which I have worked with Basile Starynkevitch
> for propagating constants inferred from conditional expressions.
> The basic testcase from which we started was something like
>
> if (x == 0)
>   a = b / x;
>
> and we wanted to issue an error for the division by zero.
> In the process we just remarked that x was not replaced by zero
> in the then_clause, and that we have support for warnings for
> division by zero only in the front ends, ie. we'll later propose a patch
> for such warnings also after CCP and other code transforms on GIMPLE.
>
> The attached patch still causes a libjava failure that I don't know how
> to fix.  The error comes from the fact that some of the new
> SSA_NAMEs are not marked correctly as occuring in abnormal phi
> nodes.  Is there some function that updates these ssa names that I forgot
> to use in the attached patch?

VRP does this transformation already (with -O2) and DOM would do so
again (and does with -O1).

I don't think we need to complicate CCP with ASSERT_EXPRs.

Richard.



More information about the Gcc-patches mailing list