From: Richard Biener <rguenther@suse.de>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH][20/n] Remove GENERIC stmt combining from SCCVN
Date: Mon, 14 Sep 2015 08:52:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1509141036321.13444@zhemvz.fhfr.qr> (raw)
In-Reply-To: <8641521.JK1D07Utdj@polaris>
On Sat, 12 Sep 2015, Eric Botcazou wrote:
> > * fold-const.c (fold_binary_loc): Move simplifying of comparisons
> > against the highest or lowest possible integer ...
> > * match.pd: ... as patterns here.
>
> This incorrectly dropped the calls to omit_one_operand_loc, resulting in the
> failure of the attached Ada test: if the operand has side effects, you cannot
> replace the entire comparison with just 'true' or 'false'.
Still trying to reproduce, but I suppose you hit
/* Comparisons with the highest or lowest possible integer of
the specified precision will have known values. */
(simplify
(cmp (convert?@2 @0) INTEGER_CST@1)
(if ((INTEGRAL_TYPE_P (TREE_TYPE (@1)) || POINTER_TYPE_P (TREE_TYPE
(@1)))
&& tree_nop_conversion_p (TREE_TYPE (@2), TREE_TYPE (@0)))
(with
{
tree arg1_type = TREE_TYPE (@1);
unsigned int prec = TYPE_PRECISION (arg1_type);
wide_int max = wi::max_value (arg1_type);
wide_int signed_max = wi::max_value (prec, SIGNED);
wide_int min = wi::min_value (arg1_type);
}
(switch
(if (wi::eq_p (@1, max))
(switch
(if (cmp == GT_EXPR)
{ constant_boolean_node (false, type); })
(if (cmp == GE_EXPR)
(eq @2 @1))
(if (cmp == LE_EXPR)
{ constant_boolean_node (true, type); })
this which should handle side-effects in @0 just fine:
/* #line 2019 "/space/rguenther/src/svn/trunk/gcc/match.pd" */
if (cmp == LE_EXPR)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Applying pattern match.pd:2020, %s:%d\n", __FILE__,
__LINE__);
tree res;
res = constant_boolean_node (true, type);
if (TREE_SIDE_EFFECTS (captures[0]))
res = build2_loc (loc, COMPOUND_EXPR, type,
fold_ignored_result (captures[0]), res);
return res;
note that genmatch "inlines" omit_one_operand, so you only see
fold_ignored_result here.
So maybe the issue is with some other pattern or was latent
elsewehere. I'll have a closer look once I manage to reproduce
the issue.
Richard.
>
> * gnat.dg/overflow_sum3.adb: New test.
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
next prev parent reply other threads:[~2015-09-14 8:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 12:45 Richard Biener
2015-09-12 16:35 ` Eric Botcazou
2015-09-14 8:52 ` Richard Biener [this message]
2015-09-14 9:00 ` Richard Biener
2015-09-14 9:47 ` Eric Botcazou
2015-09-14 9:57 ` Richard Biener
2015-09-15 7:43 ` Eric Botcazou
2015-09-14 9:05 ` Eric Botcazou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.11.1509141036321.13444@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).