aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-05-20 08:16:13 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-05-20 08:16:13 +0000
commitd1c0308e9b0f99d008b1aad2f955d1a423715a81 (patch)
tree64cca862e3e1fdc3c2795649bc8b94442a0f1313 /gcc
parent54da09ee2062f41141dbfd116975ee20509a96e3 (diff)
downloadgcc-d1c0308e9b0f99d008b1aad2f955d1a423715a81.zip
gcc-d1c0308e9b0f99d008b1aad2f955d1a423715a81.tar.gz
gcc-d1c0308e9b0f99d008b1aad2f955d1a423715a81.tar.bz2
re PR tree-optimization/61221 (ICE on valid code at -O1 and above on x86_64-linux-gnu)
2014-05-20 Richard Biener <rguenther@suse.de> PR tree-optimization/61221 * tree-ssa-pre.c (el_to_update): Remove. (eliminate_dom_walker::before_dom_children): Handle released VDEFs by value-numbering them to the associated VUSE. Update stmt immediately for substituted call address. (eliminate): Remove delayed stmt updating code. * tree-ssa-sccvn.c (vuse_ssa_val): New function valueizing possibly late re-numbered vuses. (vn_reference_lookup_2): Adjust. (vn_reference_lookup_pieces): Likewise. (vn_reference_lookup): Likewise. From-SVN: r210633
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/tree-ssa-pre.c25
-rw-r--r--gcc/tree-ssa-sccvn.c25
3 files changed, 51 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 16c7f51..26142ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2014-05-20 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/61221
+ * tree-ssa-pre.c (el_to_update): Remove.
+ (eliminate_dom_walker::before_dom_children): Handle released
+ VDEFs by value-numbering them to the associated VUSE. Update
+ stmt immediately for substituted call address.
+ (eliminate): Remove delayed stmt updating code.
+ * tree-ssa-sccvn.c (vuse_ssa_val): New function valueizing
+ possibly late re-numbered vuses.
+ (vn_reference_lookup_2): Adjust.
+ (vn_reference_lookup_pieces): Likewise.
+ (vn_reference_lookup): Likewise.
+
+2014-05-20 Richard Biener <rguenther@suse.de>
+
* config.gcc: Remove need_64bit_hwint.
* configure.ac: Do not define NEED_64BIT_HOST_WIDE_INT.
* hwint.h: Do not check NEED_64BIT_HOST_WIDE_INT but assume
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index e487d28..2929d4d 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3915,7 +3915,6 @@ compute_avail (void)
/* Local state for the eliminate domwalk. */
static vec<gimple> el_to_remove;
-static vec<gimple> el_to_update;
static unsigned int el_todo;
static vec<tree> el_avail;
static vec<tree> el_avail_stack;
@@ -4155,9 +4154,14 @@ eliminate_dom_walker::before_dom_children (basic_block b)
print_gimple_stmt (dump_file, stmt, 0, 0);
}
pre_stats.eliminations++;
+
+ tree vdef = gimple_vdef (stmt);
+ tree vuse = gimple_vuse (stmt);
propagate_tree_value_into_stmt (&gsi, sprime);
stmt = gsi_stmt (gsi);
update_stmt (stmt);
+ if (vdef != gimple_vdef (stmt))
+ VN_INFO (vdef)->valnum = vuse;
/* If we removed EH side-effects from the statement, clean
its EH information. */
@@ -4255,9 +4259,14 @@ eliminate_dom_walker::before_dom_children (basic_block b)
sprime = fold_convert (gimple_expr_type (stmt), sprime);
pre_stats.eliminations++;
+
+ tree vdef = gimple_vdef (stmt);
+ tree vuse = gimple_vuse (stmt);
propagate_tree_value_into_stmt (&gsi, sprime);
stmt = gsi_stmt (gsi);
update_stmt (stmt);
+ if (vdef != gimple_vdef (stmt))
+ VN_INFO (vdef)->valnum = vuse;
/* If we removed EH side-effects from the statement, clean
its EH information. */
@@ -4371,7 +4380,11 @@ eliminate_dom_walker::before_dom_children (basic_block b)
}
gimple_call_set_fn (stmt, fn);
- el_to_update.safe_push (stmt);
+ tree vdef = gimple_vdef (stmt);
+ tree vuse = gimple_vuse (stmt);
+ update_stmt (stmt);
+ if (vdef != gimple_vdef (stmt))
+ VN_INFO (vdef)->valnum = vuse;
/* When changing a call into a noreturn call, cfg cleanup
is needed to fix up the noreturn call. */
@@ -4430,7 +4443,6 @@ eliminate (void)
need_ab_cleanup = BITMAP_ALLOC (NULL);
el_to_remove.create (0);
- el_to_update.create (0);
el_todo = 0;
el_avail.create (0);
el_avail_stack.create (0);
@@ -4482,13 +4494,6 @@ eliminate (void)
}
el_to_remove.release ();
- /* We cannot update call statements with virtual operands during
- SSA walk. This might remove them which in turn makes our
- VN lattice invalid. */
- FOR_EACH_VEC_ELT (el_to_update, i, stmt)
- update_stmt (stmt);
- el_to_update.release ();
-
return el_todo;
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index fc00682..73362f8 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -318,6 +318,25 @@ static int *rpo_numbers;
#define SSA_VAL(x) (VN_INFO ((x))->valnum)
+/* Return the SSA value of the VUSE x, supporting released VDEFs
+ during elimination which will value-number the VDEF to the
+ associated VUSE (but not substitute in the whole lattice). */
+
+static inline tree
+vuse_ssa_val (tree x)
+{
+ if (!x)
+ return NULL_TREE;
+
+ do
+ {
+ x = SSA_VAL (x);
+ }
+ while (SSA_NAME_IN_FREE_LIST (x));
+
+ return x;
+}
+
/* This represents the top of the VN lattice, which is the universal
value. */
@@ -1495,7 +1514,7 @@ vn_reference_lookup_2 (ao_ref *op ATTRIBUTE_UNUSED, tree vuse,
/* Fixup vuse and hash. */
if (vr->vuse)
vr->hashcode = vr->hashcode - SSA_NAME_VERSION (vr->vuse);
- vr->vuse = SSA_VAL (vuse);
+ vr->vuse = vuse_ssa_val (vuse);
if (vr->vuse)
vr->hashcode = vr->hashcode + SSA_NAME_VERSION (vr->vuse);
@@ -2035,7 +2054,7 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, tree type,
vnresult = &tmp;
*vnresult = NULL;
- vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE;
+ vr1.vuse = vuse_ssa_val (vuse);
shared_lookup_references.truncate (0);
shared_lookup_references.safe_grow (operands.length ());
memcpy (shared_lookup_references.address (),
@@ -2090,7 +2109,7 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
if (vnresult)
*vnresult = NULL;
- vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE;
+ vr1.vuse = vuse_ssa_val (vuse);
vr1.operands = operands
= valueize_shared_reference_ops_from_ref (op, &valuezied_anything);
vr1.type = TREE_TYPE (op);