aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-06 12:34:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-06 12:34:15 +0000
commit0580f6a1a8eba90a82c83b8341f94d25529b25e9 (patch)
tree48545297a0d21d21dfb61cfc0c4c986165b8f10b /gcc/tree-ssa-pre.c
parentbadfb2fbefac5b03bc1731b07900e3e75d5c01f8 (diff)
downloadgcc-0580f6a1a8eba90a82c83b8341f94d25529b25e9.zip
gcc-0580f6a1a8eba90a82c83b8341f94d25529b25e9.tar.gz
gcc-0580f6a1a8eba90a82c83b8341f94d25529b25e9.tar.bz2
re PR tree-optimization/67859 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu)
2015-10-06 Richard Biener <rguenther@suse.de> PR tree-optimization/67859 * tree-ssa-pre.c (create_expression_by_pieces): Properly discard not inserted stmts. * gcc.dg/torture/pr67859.c: New testcase. From-SVN: r228519
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index fb9ed02..c5af63d 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2897,11 +2897,16 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
folded = gimple_convert (&forced_stmts, exprtype, folded);
- /* If everything simplified to an exisiting SSA name or constant just
- return that. */
- if (gimple_seq_empty_p (forced_stmts)
- || is_gimple_min_invariant (folded))
+ /* If there is nothing to insert, return the simplified result. */
+ if (gimple_seq_empty_p (forced_stmts))
return folded;
+ /* If we simplified to a constant return it and discard eventually
+ built stmts. */
+ if (is_gimple_min_invariant (folded))
+ {
+ gimple_seq_discard (forced_stmts);
+ return folded;
+ }
gcc_assert (TREE_CODE (folded) == SSA_NAME);