This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [TREE-SSA-CCP] Issue warning when folding condition
- From: Richard Biener <rguenther at suse dot de>
- To: Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>
- Date: Fri, 19 Aug 2016 10:00:15 +0200 (CEST)
- Subject: Re: [TREE-SSA-CCP] Issue warning when folding condition
- Authentication-results: sourceware.org; auth=none
- References: <CAELXzTNFE7xL+Q=8Pq_0HCjNyB2yX_iTWgPzVy2erjQhvQxGiw@mail.gmail.com> <CAELXzTMt3WULoaUgR9jBCN0kYdwMy_5aaqEss1_qdPeEywa_JQ@mail.gmail.com>
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