aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-08-01 10:47:14 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-08-01 10:47:14 +0000
commit34e5c5116fa58f77ea5eef61d8fb6b9e91c92d79 (patch)
tree6180256fcd038c7f361f782de52817a7c47b4fb4
parent35c38fa674ab01152c743f421226f3cbc829cd94 (diff)
downloadgcc-34e5c5116fa58f77ea5eef61d8fb6b9e91c92d79.zip
gcc-34e5c5116fa58f77ea5eef61d8fb6b9e91c92d79.tar.gz
gcc-34e5c5116fa58f77ea5eef61d8fb6b9e91c92d79.tar.bz2
tree-ssa-pre.c (print_pre_expr): Handle NULL expr.
2017-08-01 Richard Biener <rguenther@suse.de> * tree-ssa-pre.c (print_pre_expr): Handle NULL expr. (compute_antic): Seed worklist with exit block predecessors. * cfganal.c (dfs_find_deadend): For a cycle return the source of the edge closing it. * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust. * gcc.dg/tree-ssa/split-path-5.c: Remove case with just dead endless loop. * gcc.dg/uninit-23.c: Adjust. From-SVN: r250767
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cfganal.c19
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/uninit-23.c4
-rw-r--r--gcc/tree-ssa-pre.c13
7 files changed, 40 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aba2550..f48f0cc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-01 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-pre.c (print_pre_expr): Handle NULL expr.
+ (compute_antic): Seed worklist with exit block predecessors.
+ * cfganal.c (dfs_find_deadend): For a cycle return the source
+ of the edge closing it.
+
2017-08-01 Tamar Christina <tamar.christina@arm.com>
* config/aarch64/aarch64.c
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 792ea62..394d986 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -737,23 +737,24 @@ post_order_compute (int *post_order, bool include_entry_exit,
basic_block
dfs_find_deadend (basic_block bb)
{
- bitmap visited = BITMAP_ALLOC (NULL);
+ auto_bitmap visited;
+ basic_block next = bb;
for (;;)
{
- if (EDGE_COUNT (bb->succs) == 0
- || ! bitmap_set_bit (visited, bb->index))
- {
- BITMAP_FREE (visited);
- return bb;
- }
+ if (EDGE_COUNT (next->succs) == 0)
+ return next;
+
+ if (! bitmap_set_bit (visited, next->index))
+ return bb;
+ bb = next;
/* If we are in an analyzed cycle make sure to try exiting it.
Note this is a heuristic only and expected to work when loop
fixup is needed as well. */
if (! bb->loop_father
|| ! loop_outer (bb->loop_father))
- bb = EDGE_SUCC (bb, 0)->dest;
+ next = EDGE_SUCC (bb, 0)->dest;
else
{
edge_iterator ei;
@@ -761,7 +762,7 @@ dfs_find_deadend (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->succs)
if (loop_exit_edge_p (bb->loop_father, e))
break;
- bb = e ? e->dest : EDGE_SUCC (bb, 0)->dest;
+ next = e ? e->dest : EDGE_SUCC (bb, 0)->dest;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02df696..c901efb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-01 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust.
+ * gcc.dg/tree-ssa/split-path-5.c: Remove case with just dead
+ endless loop.
+ * gcc.dg/uninit-23.c: Adjust.
+
2017-08-01 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/no-strict-overflow-7.c: Revise comment and test string.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c b/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
index 5044c73..95aabda 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c
@@ -41,20 +41,4 @@ bmhi_init (const char *pattern)
}
}
-char *
-bmhi_search (const char *string, const int stringlen)
-{
- int i, j;
- char *s;
- for (;;)
- {
- while (--j >= 0 && (
- {
- __typeof__ (s[j]) __x = (s[j]);
- ((((__ctype_ptr__ +
- sizeof (""[__x]))[(int) (__x)]) &
- (01 | 02)) ==
- 02) ? (int) __x - 'a' +
- 'A' : (int) __x;}) == pat[j]);
-}}
-/* { dg-final { scan-tree-dump-times "Duplicating join block" 2 "split-paths" } } */
+/* { dg-final { scan-tree-dump-times "Duplicating join block" 1 "split-paths" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
index 64b30ca..863aa79 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-3.c
@@ -26,9 +26,6 @@ int main(void)
by marking the j % 7 condition as useful. See PR45178. */
/* We should eliminate the inner condition, but the loop must be preserved
- as it is infinite. Therefore there should be just one phi node (for i): */
-/* { dg-final { scan-tree-dump-times "PHI " 1 "cddce1" { xfail *-*-* } } } */
-
-/* And one if (for the exit condition of the loop): */
-/* { dg-final { scan-tree-dump-times "if " 1 "cddce1" } } */
-
+ as it is infinite. Therefore there should be just one goto and no PHI. */
+/* { dg-final { scan-tree-dump-times "PHI " 0 "cddce1" } } */
+/* { dg-final { scan-tree-dump-times "goto" 1 "cddce1" } } */
diff --git a/gcc/testsuite/gcc.dg/uninit-23.c b/gcc/testsuite/gcc.dg/uninit-23.c
index b38e1d0..d64eb7d 100644
--- a/gcc/testsuite/gcc.dg/uninit-23.c
+++ b/gcc/testsuite/gcc.dg/uninit-23.c
@@ -15,10 +15,10 @@ ql (void)
for (;;)
{
int *go;
- int *t4 = go;
+ int *t4 = go; /* { dg-warning "is used uninitialized" } */
l1:
- *t4 = (*t4 != 0) ? 0 : 2; /* { dg-warning "may be used uninitialized" } */
+ *t4 = (*t4 != 0) ? 0 : 2;
}
if (ij != 0)
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 0ec3d3c..eaadaad 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -837,7 +837,7 @@ bitmap_set_and (bitmap_set_t dest, bitmap_set_t orig)
}
}
-/* Subtract all values and expressions contained in ORIG from DEST. */
+/* Subtract all expressions contained in ORIG from DEST. */
static bitmap_set_t
bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
@@ -859,7 +859,7 @@ bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
return result;
}
-/* Subtract all the values in bitmap set B from bitmap set A. */
+/* Subtract all values in bitmap set B from bitmap set A. */
static void
bitmap_set_subtract_values (bitmap_set_t a, bitmap_set_t b)
@@ -987,6 +987,11 @@ bitmap_value_insert_into_set (bitmap_set_t set, pre_expr expr)
static void
print_pre_expr (FILE *outfile, const pre_expr expr)
{
+ if (! expr)
+ {
+ fprintf (outfile, "NULL");
+ return;
+ }
switch (expr->kind)
{
case CONSTANT:
@@ -2418,7 +2423,9 @@ compute_antic (void)
inverted_post_order_compute (&postorder);
auto_sbitmap worklist (last_basic_block_for_fn (cfun) + 1);
- bitmap_ones (worklist);
+ bitmap_clear (worklist);
+ FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
+ bitmap_set_bit (worklist, e->src->index);
while (changed)
{
if (dump_file && (dump_flags & TDF_DETAILS))