* [PATCH] Fix PR67285
@ 2015-08-20 12:41 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-08-20 12:41 UTC (permalink / raw)
To: gcc-patches
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-20 12:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 12:41 [PATCH] Fix PR67285 Richard Biener
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).