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
This commit is contained in:
Richard Biener 2015-10-06 12:34:15 +00:00 committed by Richard Biener
parent badfb2fbef
commit 0580f6a1a8
4 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,9 @@
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.
2015-10-06 Jonathan Wakely <jwakely@redhat.com>
* doc/extend.texi (Template Instantiation): Reorder options and

View File

@ -1,3 +1,8 @@
2015-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/67859
* gcc.dg/torture/pr67859.c: New testcase.
2015-10-05 Kirill Yukhin <kirill.yukhin@intel.com>
* gcc.target/i386/builtin_target.c: Add check for AES and PCLMUL.

View File

@ -0,0 +1,15 @@
/* { dg-do compile } */
int a, b, c;
void
fn1 ()
{
b = c ? 0 : 1 << a;
b |= 0x9D7A5FD9;
for (;;)
{
int d = 1;
b &= (unsigned) d;
}
}

View File

@ -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);