[TREE-SSA-CCP] Issue warning when folding condition

Richard Biener rguenther@suse.de
Fri Aug 19 08:00:00 GMT 2016


On Fri, 19 Aug 2016, Kugan Vivekanandarajah wrote:

> On 19 August 2016 at 12:09, Kugan Vivekanandarajah
> <kugan.vivekanandarajah@linaro.org> wrote:
> > The testcase pr33738.C for warning fails with early-vrp patch. The
> > reason is, with early-vrp ccp2 is folding the comparison that used to
> > be folded in simplify_stmt_for_jump_threading. Since early-vrp does
> > not perform jump-threading is not optimized there.
> >
> > Attached patch adds this warning to tree-ssa-ccp.c. We might also run
> > into some other similar issues in the future.
> 
> Sorry, I attached the wrong patch (with typo). Here is the correct one.

I think emitting this warning from GIMPLE optimizations is fundamentally
flawed and the warning should be removed there and put next to
the cases we alrady handle in c/c-common.c:shorten_compare (or in
FE specific code).  I see no reason why only VRP or CCP would
do the simplification for -fstrict-enums enums (thus it seems to be
missing from the generic comparison folders).

Richard.

> Thanks,
> Kugan
> 
> >
> > Bootstrapped and regression tested on x86_64-linux-gnu with no new regressions.
> >
> > Is this OK for trunk?
> >
> > Thanks,
> > Kugan
> >
> > gcc/ChangeLog:
> >
> > 2016-08-18  Kugan Vivekanandarajah  <kuganv@linaro.org>
> >
> >     * tree-ssa-ccp.c (ccp_fold_stmt): If the comparison is being folded
> >     and the operand on the LHS is being compared against a constant
> >     value that is outside of type limit, issue warning.
> 
k



More information about the Gcc-patches mailing list