From: Daniel Berlin Date: Mon, 17 Jan 2005 00:45:51 +0000 (+0000) Subject: tree-ssa-pre.c (add_to_sets): s1 may be NULL. X-Git-Tag: releases/gcc-4.0.0~1523 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f233d9f549b29a7fcd4f5b54b8dde438bcb5119;p=thirdparty%2Fgcc.git tree-ssa-pre.c (add_to_sets): s1 may be NULL. 2005-01-16 Daniel Berlin * tree-ssa-pre.c (add_to_sets): s1 may be NULL. (compute_avail): Uses don't go in tmp_gen. From-SVN: r93749 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3015093f73e..fb1eebeaadb8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-01-16 Daniel Berlin + + * 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 * 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 index 000000000000..839f351f53dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-3.c @@ -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"} } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index 94fd56c588dd..1a5f7ed51521 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -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. diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 8e22e2029285..ae3e66d677bd 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -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)); } }