diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-25 10:50:46 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-25 10:50:46 +0000 |
commit | 0112f07e285de966fadd997b6b728f9f871da421 (patch) | |
tree | 2e350d229d5af7a6fe9b471d21bebabc77115d0f | |
parent | 73e167c3a2935d3d6f32d8909515953c5214af2f (diff) | |
download | gcc-0112f07e285de966fadd997b6b728f9f871da421.tar.gz |
2016-04-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/70780
* tree-ssa-pre.c (compute_antic_aux): Also return true if the block
wasn't visited yet.
(compute_antic): Mark blocks with abnormal preds as visited as
they have a final empty antic-in solution already.
* gcc.dg/torture/pr70780.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@235408 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr70780.c | 26 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 10 |
4 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d0f39173a1..c47df1cea42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-04-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70780 + * tree-ssa-pre.c (compute_antic_aux): Also return true if the block + wasn't visited yet. + (compute_antic): Mark blocks with abnormal preds as visited as + they have a final empty antic-in solution already. + 2016-04-22 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16b41d87600..1374002e2cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70780 + * gcc.dg/torture/pr70780.c: New testcase. + 2016-04-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/70684 diff --git a/gcc/testsuite/gcc.dg/torture/pr70780.c b/gcc/testsuite/gcc.dg/torture/pr70780.c new file mode 100644 index 00000000000..2f7a5cbea06 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70780.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ + +int a, b, c, *d, e; + +static int +fn1 () +{ + if (a) + goto l1; +l2: while (b) + if (*d) + return c; + for (e = 0; e; e++) + { + goto l2; +l1:; + } + return 0; +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 964a70faada..c9600906b9d 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2081,6 +2081,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) unsigned int bii; edge e; edge_iterator ei; + bool was_visited = BB_VISITED (block); old = ANTIC_OUT = S = NULL; BB_VISITED (block) = 1; @@ -2171,7 +2172,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) clean (ANTIC_IN (block)); - if (!bitmap_set_equal (old, ANTIC_IN (block))) + if (!was_visited || !bitmap_set_equal (old, ANTIC_IN (block))) changed = true; maybe_dump_sets: @@ -2349,15 +2350,18 @@ compute_antic (void) FOR_ALL_BB_FN (block, cfun) { + BB_VISITED (block) = 0; + FOR_EACH_EDGE (e, ei, block->preds) if (e->flags & EDGE_ABNORMAL) { bitmap_set_bit (has_abnormal_preds, block->index); + + /* We also anticipate nothing. */ + BB_VISITED (block) = 1; break; } - BB_VISITED (block) = 0; - /* While we are here, give empty ANTIC_IN sets to each block. */ ANTIC_IN (block) = bitmap_set_new (); PA_IN (block) = bitmap_set_new (); |