re PR tree-optimization/76783 (wrong code with conditional vector assignment @ -Og)
authorRichard Biener <rguenther@suse.de>
Tue, 16 Aug 2016 11:22:47 +0000 (11:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 16 Aug 2016 11:22:47 +0000 (11:22 +0000)
2016-08-16  Richard Biener  <rguenther@suse.de>

PR tree-optimization/76783
* tree-ssa-propagate.c (ssa_prop_init): Use RPO order.  Clear
BB visited flags at start.

* gcc.dg/pr76783.c: New testcase.
* gcc.dg/tree-ssa/pr69270-2.c: Adjust.

From-SVN: r239496

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr76783.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr69270-2.c
gcc/tree-ssa-propagate.c

index 99fb2d2c82cd0ec2d4d838725e50d47698b2d318..18a191f5bed22a5776e8d1e53c460426f535a6b9 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-16  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/76783
+       * tree-ssa-propagate.c (ssa_prop_init): Use RPO order.  Clear
+       BB visited flags at start.
+
 2016-08-16  Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/72817
index 26266dfae670958df22dfca6f67bc734d9a525ea..10749112afe3cd7382b7815af442d142a24bd020 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-16  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/76783
+       * gcc.dg/pr76783.c: New testcase.
+       * gcc.dg/tree-ssa/pr69270-2.c: Adjust.
+
 2016-08-16  Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/72817
diff --git a/gcc/testsuite/gcc.dg/pr76783.c b/gcc/testsuite/gcc.dg/pr76783.c
new file mode 100644 (file)
index 0000000..22aef56
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-Og -w -Wno-psabi" } */
+
+typedef unsigned __int128 u128;
+typedef unsigned __int128 v64u128 __attribute__ ((vector_size (64)));
+
+u128 __attribute__ ((noinline, noclone))
+foo (unsigned c, v64u128 v)
+{
+  v64u128 u;
+  if (c) {
+    u = (v64u128){(u128)0, (u128)0};
+  } else {
+    u = (v64u128){(u128)0, (u128)1};
+  }
+  u += v;
+  return u[1];
+}
+
+int
+main ()
+{
+  u128 x = foo (0, (v64u128){ });
+  if (x != 1)
+    __builtin_abort();
+  return 0;
+}
index 15c7bdda15a5abf5d893f781b96b2c080faff3fd..b617f2df30295081e2a67b65cf65b2c007021c96 100644 (file)
@@ -1,16 +1,8 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom3-details -w" } */
+/* { dg-options "-O2 -fdump-tree-dce2 -w" } */
 
-/* There should be a reference to usecount that turn into
-   constants.  */
-/* { dg-final { scan-tree-dump-times "Replaced .usecount_\[0-9\]+. with constant .1." 1 "dom3"} } */
-
-/* And an assignment using usecount ought to fold down to constants.  */
-/* { dg-final { scan-tree-dump-times "Folded to: usecount_\[0-9\]+ = 2;" 1 "dom3"} } */
-
-/* The arithmetic using usecount should be gone, except for the one in the
-   details debugging.  */
-/* { dg-final { scan-tree-dump-times "usecount_\[0-9\]+ = usecount_\[0-9\]+ . 1;" 1 "dom3"} } */
+/* The arithmetic using usecount should be gone.  */
+/* { dg-final { scan-tree-dump-times "usecount_\[0-9\]+ = usecount_\[0-9\]+ . 1;" 0 "dce2"} } */
 
 typedef union tree_node *tree;
 typedef union gimple_statement_d *gimple;
index 6cbcd447de9da9868b6db8dd7894ae5be3dd3abd..c8cf0783e103a7c23e899847d17c25a3706e3eca 100644 (file)
@@ -422,8 +422,8 @@ ssa_prop_init (void)
   /* Worklist of basic-blocks.  */
   bb_to_cfg_order = XNEWVEC (int, last_basic_block_for_fn (cfun) + 1);
   cfg_order_to_bb = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
-  int n = pre_and_rev_post_order_compute_fn (cfun, cfg_order_to_bb,
-                                            NULL, false);
+  int n = pre_and_rev_post_order_compute_fn (cfun, NULL,
+                                            cfg_order_to_bb, false);
   for (int i = 0; i < n; ++i)
     bb_to_cfg_order[cfg_order_to_bb[i]] = i;
   cfg_blocks = BITMAP_ALLOC (NULL);
@@ -453,7 +453,7 @@ ssa_prop_init (void)
          gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
        }
 
-      gcc_assert (! (bb->flags & BB_VISITED));
+      bb->flags &= ~BB_VISITED;
       FOR_EACH_EDGE (e, ei, bb->succs)
        e->flags &= ~EDGE_EXECUTABLE;
     }