From f73f8bab9f2474f175cc5ca5ba8ebb32808a4cae Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 25 May 2020 09:17:51 +0200 Subject: [PATCH] tree-optimization/95284 - amend previous store commoning fix Generalize check for clobbers. 2020-05-25 Richard Biener PR tree-optimization/95284 * tree-ssa-sink.c (sink_common_stores_to_bb): Amend previous fix. * g++.dg/torture/pr95284.C: New testcase. --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr95284.C | 16 ++++++++++++++++ gcc/tree-ssa-sink.c | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr95284.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a808b710e7..8a089279e1b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-05-25 Richard Biener + + PR tree-optimization/95284 + * tree-ssa-sink.c (sink_common_stores_to_bb): Amend previous + fix. + 2020-05-25 Hongtao Liu PR target/95125 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 99cdfd0929e..db94bd05bc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-05-25 Richard Biener + + PR tree-optimization/95284 + * g++.dg/torture/pr95284.C: New testcase. + 2020-05-25 Eric Botcazou * gnat.dg/renaming16.adb: New test. diff --git a/gcc/testsuite/g++.dg/torture/pr95284.C b/gcc/testsuite/g++.dg/torture/pr95284.C new file mode 100644 index 00000000000..3c273ef8d55 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr95284.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-require-effective-target lp64 } + +#include + +short a; +unsigned long long c; +char d; +unsigned e; + +void f() +{ + for (;;) + for (char b = 0; b < 19; b += 2) + a = std::min((1 ? d : 0) ? e : c, (unsigned long long)72252803048); +} diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index b61ecf12d1f..962ad076968 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -536,7 +536,7 @@ sink_common_stores_to_bb (basic_block bb) else if (! operand_equal_p (gimple_assign_lhs (first_store), gimple_assign_lhs (def), 0) || (gimple_clobber_p (first_store) - && !gimple_clobber_p (def))) + != gimple_clobber_p (def))) { first_store = NULL; break; -- 2.30.2