From 9b604bc14c9c33c3eda73f97c6479b4ce9b9e6a1 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 11 Aug 2015 12:34:06 +0000 Subject: [PATCH] * tree-ssa-phiopt.c (minmax_replacement): Create new ssa name if we're not the only contributor to target phi. testsuite/ * c-c++-common/dfp/operator-comma.c: Call init function. * c-c++-common/dfp/convert-dfp-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/c-c++-common/dfp/convert-dfp-2.c | 45 +++++++++++++++++++++++++ gcc/testsuite/c-c++-common/dfp/operator-comma.c | 2 ++ gcc/tree-ssa-phiopt.c | 10 +++++- 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/dfp/convert-dfp-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61fd887a65a..3a078162b35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-08-11 Nathan Sidwell + + * tree-ssa-phiopt.c (minmax_replacement): Create new ssa name if + we're not the only contributor to target phi. + 2015-08-11 Jiong Wang * config/aarch64/aarch64.h (REG_CLASS_NAMES): Add the missing ',' after diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 34a5c1a593e..8d4903f5b62 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-11 Nathan Sidwell + + * c-c++-common/dfp/operator-comma.c: Call init function. + * c-c++-common/dfp/convert-dfp-2.c: New test. + 2015-08-10 H.J. Lu * gcc.target/i386/builtin_target.c (check_intel_cpu_model): diff --git a/gcc/testsuite/c-c++-common/dfp/convert-dfp-2.c b/gcc/testsuite/c-c++-common/dfp/convert-dfp-2.c new file mode 100644 index 00000000000..a50b202885c --- /dev/null +++ b/gcc/testsuite/c-c++-common/dfp/convert-dfp-2.c @@ -0,0 +1,45 @@ +/* { dg-options "-O0" } */ + +/* Test decimal fp conversions of zero. */ + +#include "dfp-dbg.h" + +volatile _Decimal32 d32a, d32c; +volatile _Decimal64 d64a, d64c; +volatile _Decimal128 d128a, d128c; + +int +main () +{ + d32a = d32c; + if (d32a) + FAILURE + d32a = d64c; + if (d32a) + FAILURE + d32a = d128c; + if (d32a) + FAILURE + + d64a = d32c; + if (d64a) + FAILURE + d64a = d64c; + if (d64a) + FAILURE + d64a = d128c; + if (d64a) + FAILURE + + d128a = d32c; + if (d128a) + FAILURE + d128a = d64c; + if (d128a) + FAILURE + d128a = d128c; + if (d128a) + FAILURE + + FINISH +} diff --git a/gcc/testsuite/c-c++-common/dfp/operator-comma.c b/gcc/testsuite/c-c++-common/dfp/operator-comma.c index be6bf6f8cd1..7055087ba6e 100644 --- a/gcc/testsuite/c-c++-common/dfp/operator-comma.c +++ b/gcc/testsuite/c-c++-common/dfp/operator-comma.c @@ -24,6 +24,8 @@ init () int main () { + init (); + d32a = (d32b, d32c); if (d32a != d32c) FAILURE diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 633ccc7edf2..d46ba622961 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1277,8 +1277,16 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb, gsi_move_before (&gsi_from, &gsi); } + /* Create an SSA var to hold the min/max result. If we're the only + things setting the target PHI, then we can clone the PHI + variable. Otherwise we must create a new one. */ + result = PHI_RESULT (phi); + if (EDGE_COUNT (gimple_bb (phi)->preds) == 2) + result = duplicate_ssa_name (result, NULL); + else + result = make_ssa_name (TREE_TYPE (result)); + /* Emit the statement to compute min/max. */ - result = duplicate_ssa_name (PHI_RESULT (phi), NULL); new_stmt = gimple_build_assign (result, minmax, arg0, arg1); gsi = gsi_last_bb (cond_bb); gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT); -- 2.11.4.GIT