summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-23 14:28:59 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-23 14:28:59 +0000
commit48694fc0bcb705daf70c22d5e3d836ee90b0685a (patch)
tree48a10a4d1d5afd593e94941b3bf4da1a06912d68 /gcc/tree-ssa-sccvn.c
parentd383205a7b5f1873e1a37b64beef9d385543f93c (diff)
downloadgcc-48694fc0bcb705daf70c22d5e3d836ee90b0685a.tar.gz
2007-11-23 Richard Guenther <rguenther@suse.de>
Michael Matz <matz@suse.de> PR tree-optimization/34176 * alloc-pool.h (empty_alloc_pool): Declare. * alloc-pool.c (empty_alloc_pool): New function. * tree-ssa-sccvn.c (vn_reference_lookup): Also lookup from the valid table if a lookup from the optimistic table failed. (vn_unary_op_lookup): Likewise. (vn_binary_op_lookup): Likewise. (vn_phi_lookup): Likewise. (process_scc): Clear optimistic tables before every iteration. * gcc.c-torture/execute/pr34176.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130379 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index b4fb014b76d..8edd03b9ad7 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -655,6 +655,9 @@ vn_reference_lookup (tree op, VEC (tree, gc) *vuses)
vr1.hashcode = vn_reference_compute_hash (&vr1);
slot = htab_find_slot_with_hash (current_info->references, &vr1, vr1.hashcode,
NO_INSERT);
+ if (!slot && current_info == optimistic_info)
+ slot = htab_find_slot_with_hash (valid_info->references, &vr1, vr1.hashcode,
+ NO_INSERT);
if (!slot)
return NULL_TREE;
@@ -742,6 +745,9 @@ vn_unary_op_lookup (tree op)
vuo1.hashcode = vn_unary_op_compute_hash (&vuo1);
slot = htab_find_slot_with_hash (current_info->unary, &vuo1, vuo1.hashcode,
NO_INSERT);
+ if (!slot && current_info == optimistic_info)
+ slot = htab_find_slot_with_hash (valid_info->unary, &vuo1, vuo1.hashcode,
+ NO_INSERT);
if (!slot)
return NULL_TREE;
return ((vn_unary_op_t)*slot)->result;
@@ -834,6 +840,9 @@ vn_binary_op_lookup (tree op)
vbo1.hashcode = vn_binary_op_compute_hash (&vbo1);
slot = htab_find_slot_with_hash (current_info->binary, &vbo1, vbo1.hashcode,
NO_INSERT);
+ if (!slot && current_info == optimistic_info)
+ slot = htab_find_slot_with_hash (valid_info->binary, &vbo1, vbo1.hashcode,
+ NO_INSERT);
if (!slot)
return NULL_TREE;
return ((vn_binary_op_t)*slot)->result;
@@ -960,6 +969,9 @@ vn_phi_lookup (tree phi)
vp1.hashcode = vn_phi_compute_hash (&vp1);
slot = htab_find_slot_with_hash (current_info->phis, &vp1, vp1.hashcode,
NO_INSERT);
+ if (!slot && current_info == optimistic_info)
+ slot = htab_find_slot_with_hash (valid_info->phis, &vp1, vp1.hashcode,
+ NO_INSERT);
if (!slot)
return NULL_TREE;
return ((vn_phi_t)*slot)->result;
@@ -1799,6 +1811,14 @@ process_scc (VEC (tree, heap) *scc)
{
changed = false;
iterations++;
+ htab_empty (optimistic_info->unary);
+ htab_empty (optimistic_info->binary);
+ htab_empty (optimistic_info->phis);
+ htab_empty (optimistic_info->references);
+ empty_alloc_pool (optimistic_info->unary_op_pool);
+ empty_alloc_pool (optimistic_info->binary_op_pool);
+ empty_alloc_pool (optimistic_info->phis_pool);
+ empty_alloc_pool (optimistic_info->references_pool);
for (i = 0; VEC_iterate (tree, scc, i, var); i++)
changed |= visit_use (var);
}