aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-03-14 08:07:45 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-03-14 08:07:45 +0000
commitec64ffc8501c20efdebefb494f3c90ab44199b60 (patch)
tree579ef57ef3cf179c52ec685a1460b1bab0a52192 /gcc/tree-ssa-pre.c
parent8fef0dc6a9479bdd4f82e52f7b7e1e678a817b75 (diff)
downloadgcc-ec64ffc8501c20efdebefb494f3c90ab44199b60.zip
gcc-ec64ffc8501c20efdebefb494f3c90ab44199b60.tar.gz
gcc-ec64ffc8501c20efdebefb494f3c90ab44199b60.tar.bz2
re PR tree-optimization/84830 (ICE in compute_antic, at tree-ssa-pre.c:2388)
2018-03-14 Richard Biener <rguenther@suse.de> PR tree-optimization/84830 * tree-ssa-pre.c (compute_antic_aux): Intersect the new ANTIC_IN with the old one to avoid oscillations. * gcc.dg/torture/pr84830.c: New testcase. From-SVN: r258514
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index f165a1e..c3d2bba 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2154,6 +2154,35 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
/* clean (ANTIC_IN (block)) is defered to after the iteration converged
because it can cause non-convergence, see for example PR81181. */
+ /* Intersect ANTIC_IN with the old ANTIC_IN. This is required until
+ we properly represent the maximum expression set, thus not prune
+ values without expressions during the iteration. */
+ if (was_visited
+ && bitmap_and_into (&ANTIC_IN (block)->values, &old->values))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "warning: intersecting with old ANTIC_IN "
+ "shrinks the set\n");
+ /* Prune expressions not in the value set. */
+ bitmap_iterator bi;
+ unsigned int i;
+ unsigned int to_clear = -1U;
+ FOR_EACH_EXPR_ID_IN_SET (ANTIC_IN (block), i, bi)
+ {
+ if (to_clear != -1U)
+ {
+ bitmap_clear_bit (&ANTIC_IN (block)->expressions, to_clear);
+ to_clear = -1U;
+ }
+ pre_expr expr = expression_for_id (i);
+ unsigned int value_id = get_expr_value_id (expr);
+ if (!bitmap_bit_p (&ANTIC_IN (block)->values, value_id))
+ to_clear = i;
+ }
+ if (to_clear != -1U)
+ bitmap_clear_bit (&ANTIC_IN (block)->expressions, to_clear);
+ }
+
if (!bitmap_set_equal (old, ANTIC_IN (block)))
{
changed = true;