tree-optimization/95284 - amend previous store commoning fix
authorRichard Biener <rguenther@suse.de>
Mon, 25 May 2020 07:17:51 +0000 (09:17 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 25 May 2020 09:17:09 +0000 (11:17 +0200)
Generalize check for clobbers.

2020-05-25  Richard Biener  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr95284.C [new file with mode: 0644]
gcc/tree-ssa-sink.c

index 1a808b710e76bbaa24b13c9438c5fe1ebdcf1583..8a089279e1b293247e872841d11bc2c8b05a5a16 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/95284
+       * tree-ssa-sink.c (sink_common_stores_to_bb): Amend previous
+       fix.
+
 2020-05-25  Hongtao Liu  <hongtao.liu@intel.com>
 
        PR target/95125
index 99cdfd0929e71db010b1fdb640dabe81cf47f4ee..db94bd05bc3248c1c2597f41049ffcbbbc8d1daa 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/95284
+       * g++.dg/torture/pr95284.C: New testcase.
+
 2020-05-25  Eric Botcazou  <ebotcazou@adacore.com>
 
        * 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 (file)
index 0000000..3c273ef
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-require-effective-target lp64 }
+
+#include <algorithm>
+
+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);
+}
index b61ecf12d1fe2fb650b998ec9bfe1dede0dd2889..962ad076968a9112fb62092458ccc585b71bcd04 100644 (file)
@@ -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;