backport: re PR tree-optimization/54877 (ICE: tree check: expected ssa_name, have real_cst in copy_ssa_name_fn, at tree-ssanames.c:335)

Backported from mainline
	2012-10-10  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/54877
	* tree-vect-loop.c (vect_is_simple_reduction_1): For MINUS_EXPR
	use make_ssa_name instead of copy_ssa_name.

	* gcc.dg/torture/pr54877.c: New test.

From-SVN: r193164
This commit is contained in:
Jakub Jelinek 2012-11-05 16:05:42 +01:00 committed by Jakub Jelinek
parent 7f59119bf4
commit 8f47a0b0bb
4 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2012-11-05 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2012-10-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/54877
* tree-vect-loop.c (vect_is_simple_reduction_1): For MINUS_EXPR
use make_ssa_name instead of copy_ssa_name.
2012-11-03 Peter Bergner <bergner@vnet.ibm.com>
Backport from mainline

View File

@ -1,3 +1,11 @@
2012-11-05 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2012-10-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/54877
* gcc.dg/torture/pr54877.c: New test.
2012-11-02 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/pr54985.c: New test.

View File

@ -0,0 +1,23 @@
/* PR tree-optimization/54877 */
/* { dg-do run } */
/* { dg-options "-ffast-math" } */
extern void abort (void);
int
foo (void)
{
double d;
int i;
for (i = 0, d = 0; i < 64; i++)
d--;
return (int) d;
}
int
main ()
{
if (foo () != -64)
abort ();
return 0;
}

View File

@ -2257,7 +2257,10 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
if (orig_code == MINUS_EXPR)
{
tree rhs = gimple_assign_rhs2 (def_stmt);
tree negrhs = make_ssa_name (SSA_NAME_VAR (rhs), NULL);
tree var = TREE_CODE (rhs) == SSA_NAME
? SSA_NAME_VAR (rhs)
: create_tmp_reg (TREE_TYPE (rhs), NULL);
tree negrhs = make_ssa_name (var, NULL);
gimple negate_stmt = gimple_build_assign_with_ops (NEGATE_EXPR, negrhs,
rhs, NULL);
gimple_stmt_iterator gsi = gsi_for_stmt (def_stmt);