aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-03-05 13:18:12 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-03-05 13:18:12 +0000
commit36a9f50ca9813b31879486a6eb536745dd43b9f5 (patch)
treea4fc4acdc05dc147b9ade90007f6507b8f2cc0ff /gcc
parent144a822fec6d680b2847f2bd35a6d6ebefd2d885 (diff)
downloadgcc-36a9f50ca9813b31879486a6eb536745dd43b9f5.zip
gcc-36a9f50ca9813b31879486a6eb536745dd43b9f5.tar.gz
gcc-36a9f50ca9813b31879486a6eb536745dd43b9f5.tar.bz2
re PR tree-optimization/84670 (ICE: in compute_antic_aux, at tree-ssa-pre.c:2148 with -O2 -fno-tree-dominator-opts)
2018-03-05 Richard Biener <rguenther@suse.de> PR tree-optimization/84670 * tree-ssa-pre.c (struct bb_bitmap_sets): Add visited_with_visited_succs member. (BB_VISITED_WITH_VISITED_SUCCS): New define. (compute_antic): Initialize BB_VISITED_WITH_VISITED_SUCCS. (compute_antic_aux): Only assert the number of values in ANTIC_IN doesn't grow if all successors (recursively) were visited at least once. * gcc.dg/pr84670-1.c: New testcase. * gcc.dg/pr84670-2.c: Likewise. * gcc.dg/pr84670-3.c: Likewise. * gcc.dg/pr84670-4.c: Likewise. From-SVN: r258243
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/pr84670-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr84670-2.c33
-rw-r--r--gcc/testsuite/gcc.dg/pr84670-3.c38
-rw-r--r--gcc/testsuite/gcc.dg/pr84670-4.c17
-rw-r--r--gcc/tree-ssa-pre.c15
7 files changed, 139 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ba2a9c4..6129f96 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
2018-03-05 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/84670
+ * tree-ssa-pre.c (struct bb_bitmap_sets): Add visited_with_visited_succs
+ member.
+ (BB_VISITED_WITH_VISITED_SUCCS): New define.
+ (compute_antic): Initialize BB_VISITED_WITH_VISITED_SUCCS.
+ (compute_antic_aux): Only assert the number of values in ANTIC_IN
+ doesn't grow if all successors (recursively) were visited at least
+ once.
+
+2018-03-05 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/84650
* tree-ssa-loop-im.c (pass_lim::execute): Reset the SCEV cache
if executed in the loop pipeline.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 48c40fa..97ae019 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2018-03-05 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/84670
+ * gcc.dg/pr84670-1.c: New testcase.
+ * gcc.dg/pr84670-2.c: Likewise.
+ * gcc.dg/pr84670-3.c: Likewise.
+ * gcc.dg/pr84670-4.c: Likewise.
+
+2018-03-05 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/84650
* gcc.dg/graphite/pr84650.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr84670-1.c b/gcc/testsuite/gcc.dg/pr84670-1.c
new file mode 100644
index 0000000..c1ad474
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84670-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fno-tree-dominator-opts" } */
+
+int a, b, c, d;
+
+int
+foo (void)
+{
+ __int128 i;
+l:
+ i -= c;
+ if (b)
+ goto l;
+ __builtin_mul_overflow (0, a, &c);
+ if (d)
+ goto l;
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84670-2.c b/gcc/testsuite/gcc.dg/pr84670-2.c
new file mode 100644
index 0000000..80fb368
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84670-2.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+enum b
+{
+ c,
+ d
+};
+struct e
+{
+ enum b code;
+};
+struct f
+{
+ unsigned g;
+};
+int h, i;
+struct a
+{
+ struct e common;
+ struct f j;
+};
+
+struct a k (void)
+{
+ struct a *l;
+ do
+ if (l->common.code == d && l->j.g * 4)
+ ;
+ else
+ i = l->j.g | (l->common.code && l);
+ while (h && l->common.code == c);
+}
diff --git a/gcc/testsuite/gcc.dg/pr84670-3.c b/gcc/testsuite/gcc.dg/pr84670-3.c
new file mode 100644
index 0000000..b60a94a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84670-3.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fno-strict-overflow" } */
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef u16 acpi_rs_length;
+typedef u32 acpi_rsdesc_size;
+struct acpi_resource_source
+{
+ u16 string_length;
+ char *string_ptr;
+};
+static u16
+acpi_rs_strcpy (char *destination, char *source)
+{
+ u16 i;
+ for (i = 0; source[i]; i++)
+ {
+ }
+ return ((u16) (i + 1));
+}
+union aml_resource;
+acpi_rs_length
+acpi_rs_get_resource_source (acpi_rs_length resource_length,
+ acpi_rs_length minimum_length,
+ struct acpi_resource_source * resource_source,
+ union aml_resource * aml, char *string_ptr)
+{
+ acpi_rsdesc_size total_length;
+ u8 *aml_resource_source;
+ if (total_length > (acpi_rsdesc_size) (minimum_length + 1))
+ {
+ resource_source->string_length =
+ acpi_rs_strcpy (resource_source->string_ptr,
+ ((char *) (void *) (&aml_resource_source[1])));
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr84670-4.c b/gcc/testsuite/gcc.dg/pr84670-4.c
new file mode 100644
index 0000000..00bd13a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84670-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fwrapv" } */
+
+char *a;
+int b(void)
+{
+ long d;
+ if (a) {
+ char c;
+ while ((c = *a) && !((unsigned)c - '0' <= 9) && c != ',' && c != '-'
+ && c != '+')
+ ++a;
+ d = (long)a;
+ }
+ if (*a)
+ return d;
+}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index a535c32..fa3daf4 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -484,6 +484,10 @@ typedef struct bb_bitmap_sets
/* True if we have visited this block during ANTIC calculation. */
unsigned int visited : 1;
+ /* True if we have visited this block after all successors have been
+ visited this way. */
+ unsigned int visited_with_visited_succs : 1;
+
/* True when the block contains a call that might not return. */
unsigned int contains_may_not_return_call : 1;
} *bb_value_sets_t;
@@ -497,6 +501,8 @@ typedef struct bb_bitmap_sets
#define NEW_SETS(BB) ((bb_value_sets_t) ((BB)->aux))->new_sets
#define EXPR_DIES(BB) ((bb_value_sets_t) ((BB)->aux))->expr_dies
#define BB_VISITED(BB) ((bb_value_sets_t) ((BB)->aux))->visited
+#define BB_VISITED_WITH_VISITED_SUCCS(BB) \
+ ((bb_value_sets_t) ((BB)->aux))->visited_with_visited_succs
#define BB_MAY_NOTRETURN(BB) ((bb_value_sets_t) ((BB)->aux))->contains_may_not_return_call
#define BB_LIVE_VOP_ON_EXIT(BB) ((bb_value_sets_t) ((BB)->aux))->vop_on_exit
@@ -2032,6 +2038,8 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
{
e = single_succ_edge (block);
gcc_assert (BB_VISITED (e->dest));
+ BB_VISITED_WITH_VISITED_SUCCS (block)
+ = BB_VISITED_WITH_VISITED_SUCCS (e->dest);
phi_translate_set (ANTIC_OUT, ANTIC_IN (e->dest), e);
}
/* If we have multiple successors, we take the intersection of all of
@@ -2042,6 +2050,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
size_t i;
edge first = NULL;
+ BB_VISITED_WITH_VISITED_SUCCS (block) = true;
auto_vec<edge> worklist (EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs)
{
@@ -2060,6 +2069,8 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
fprintf (dump_file, "ANTIC_IN is MAX on %d->%d\n",
e->src->index, e->dest->index);
}
+ BB_VISITED_WITH_VISITED_SUCCS (block)
+ &= BB_VISITED_WITH_VISITED_SUCCS (e->dest);
}
/* Of multiple successors we have to have visited one already
@@ -2139,7 +2150,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
changed = true;
/* After the initial value set computation the value set may
only shrink during the iteration. */
- if (was_visited && flag_checking)
+ if (was_visited && BB_VISITED_WITH_VISITED_SUCCS (block) && flag_checking)
{
bitmap_iterator bi;
unsigned int i;
@@ -2318,6 +2329,7 @@ compute_antic (void)
FOR_ALL_BB_FN (block, cfun)
{
BB_VISITED (block) = 0;
+ BB_VISITED_WITH_VISITED_SUCCS (block) = 0;
FOR_EACH_EDGE (e, ei, block->preds)
if (e->flags & EDGE_ABNORMAL)
@@ -2334,6 +2346,7 @@ compute_antic (void)
/* At the exit block we anticipate nothing. */
BB_VISITED (EXIT_BLOCK_PTR_FOR_FN (cfun)) = 1;
+ BB_VISITED_WITH_VISITED_SUCCS (EXIT_BLOCK_PTR_FOR_FN (cfun)) = 1;
/* For ANTIC computation we need a postorder that also guarantees that
a block with a single successor is visited after its successor.