diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09899f30671..cda36e7257c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-12 Marek Polacek + Marc Glisse + + PR tree-optimization/57980 + * tree-tailcall.c (process_assignment): Call build_minus_one_cst + when creating -1 constant. + 2013-08-10 Jan Hubicka Workaround binutils PR14342. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ff0e588d6f..4f0e3f12944 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-12 Marek Polacek + + PR tree-optimization/57980 + * gcc.dg/pr57980.c: New test. + 2013-08-12 Thomas Koenig PR fortran/56666 diff --git a/gcc/testsuite/gcc.dg/pr57980.c b/gcc/testsuite/gcc.dg/pr57980.c new file mode 100644 index 00000000000..682f0f477d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr57980.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/57980 */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls" } */ + +typedef int V __attribute__ ((vector_size (sizeof (int)))); +extern V f (void); + +V +bar (void) +{ + return -f (); +} + +V +foo (void) +{ + V v = { }; + return v - f (); +} diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 8cd7255e49b..c9716e708c0 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -326,11 +326,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, return true; case NEGATE_EXPR: - if (FLOAT_TYPE_P (TREE_TYPE (op0))) - *m = build_real (TREE_TYPE (op0), dconstm1); - else - *m = build_int_cst (TREE_TYPE (op0), -1); - + *m = build_minus_one_cst (TREE_TYPE (op0)); *ass_var = dest; return true; @@ -339,11 +335,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); else { - if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var))) - *m = build_real (TREE_TYPE (non_ass_var), dconstm1); - else - *m = build_int_cst (TREE_TYPE (non_ass_var), -1); - + *m = build_minus_one_cst (TREE_TYPE (non_ass_var)); *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); }