From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR67285
Date: Thu, 20 Aug 2015 12:41:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1508201430060.4884@zhemvz.fhfr.qr> (raw)
The following patch avoids breaking virtual SSA form in fold_stmt by
making sure we only ever generate calls to const functions in
simplify expression replacements.
Bootstrap & regtest running on x86_64-unknown-linux-gnu.
Richard.
2015-08-20 Richard Biener <rguenther@suse.de>
PR middle-end/67285
* gimple-fold.c (replace_stmt_with_simplification): Assert
seq is empty when replacing a call with itself but different
arguments.
* gimple-match-head.c (maybe_push_res_to_seq): When pushing
a call require that it is const.
Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c (revision 227031)
+++ gcc/gimple-fold.c (working copy)
@@ -3308,6 +3308,7 @@ replace_stmt_with_simplification (gimple
}
if (i < 3)
gcc_assert (ops[i] == NULL_TREE);
+ gcc_assert (gimple_seq_empty_p (*seq));
return true;
}
else if (!inplace)
Index: gcc/gimple-match-head.c
===================================================================
--- gcc/gimple-match-head.c (revision 227031)
+++ gcc/gimple-match-head.c (working copy)
@@ -338,6 +338,9 @@ maybe_push_res_to_seq (code_helper rcode
tree decl = builtin_decl_implicit (rcode);
if (!decl)
return NULL_TREE;
+ /* We can't and should not emit calls to non-const functions. */
+ if (!(flags_from_decl_or_type (decl) & ECF_CONST))
+ return NULL_TREE;
/* Play safe and do not allow abnormals to be mentioned in
newly created statements. */
unsigned nargs;
reply other threads:[~2015-08-20 12:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.1508201430060.4884@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--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).