tree-ssa-pre.c (add_to_sets): s1 may be NULL.
authorDaniel Berlin <dberlin@dberlin.org>
Mon, 17 Jan 2005 00:45:51 +0000 (00:45 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Mon, 17 Jan 2005 00:45:51 +0000 (00:45 +0000)
2005-01-16  Daniel Berlin  <dberlin@dberlin.org>

* tree-ssa-pre.c (add_to_sets): s1 may be NULL.
(compute_avail): Uses don't go in tmp_gen.

From-SVN: r93749

gcc/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect.exp
gcc/tree-ssa-pre.c

index a301509..fb1eebe 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-16  Daniel Berlin  <dberlin@dberlin.org>
+
+       * tree-ssa-pre.c (add_to_sets): s1 may be NULL.
+       (compute_avail): Uses don't go in tmp_gen.
+
 2005-01-16  Steven Bosscher  <stevenb@suse.de>
 
        * ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-3.c
new file mode 100644 (file)
index 0000000..839f351
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */ 
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+unsigned foo1 (unsigned a, unsigned b)
+{
+  unsigned i, j, k;
+  for (i = 0; i != a; i++)
+    {
+      j += 4*b;
+      k += 4*a;
+    }
+  return j + k;
+}
+/* We should eliminate both 4*b and 4*a from the main body of the loop */
+/* { dg-final { scan-tree-dump-times "Eliminated:2" 1 "pre"} } */
index 94fd56c..1a5f7ed 100644 (file)
@@ -23,7 +23,7 @@ load_lib gcc-dg.exp
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fdump-tree-vect-stats"
+lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fdump-tree-vect-stats" "-fno-tree-pre"
 
 # If the target system supports vector instructions, the default action
 # for a test is 'run', otherwise it's 'compile'.  Save current default.
index 8e22e20..ae3e66d 100644 (file)
@@ -1695,7 +1695,8 @@ add_to_sets (tree var, tree expr, vuse_optype vuses, bitmap_set_t s1,
   if (var != expr)
     vn_add (var, val, NULL);
 
-  bitmap_insert_into_set (s1, var);
+  if (s1)
+    bitmap_insert_into_set (s1, var);
   bitmap_value_insert_into_set (s2, var);
 }
 
@@ -1881,8 +1882,7 @@ compute_avail (void)
          for (j = 0; j < NUM_USES (STMT_USE_OPS (stmt)); j++)
            {
              tree use = USE_OP (STMT_USE_OPS (stmt), j);
-             add_to_sets (use, use, NULL, TMP_GEN (block),
-                           AVAIL_OUT (block));
+             add_to_sets (use, use, NULL, NULL, AVAIL_OUT (block));
            }
        }