summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-strlen.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-08-30 14:41:17 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-08-30 14:41:17 +0200
commit8b29fd4e11c04cd6ef48f6874cb446e553e6cfca (patch)
tree54be20e071ba593541b99d863786e7130f9104e0 /gcc/tree-ssa-strlen.c
parent26d75703036bbdd170c157fd70a5ff1a29c27f22 (diff)
downloadgcc-8b29fd4e11c04cd6ef48f6874cb446e553e6cfca.tar.gz
re PR tree-optimization/58277 (wrong code at -O3)
PR tree-optimization/58277 * tree-ssa-strlen.c (strlen_enter_block): If do_invalidate gave up after seeing too many stmts with vdef in between dombb and current bb, invalidate everything. * gcc.c-torture/execute/pr58277-1.c: New test. * gcc.c-torture/execute/pr58277-2.c: New test. From-SVN: r202104
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r--gcc/tree-ssa-strlen.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 75d27f1989b..5c21b92ec68 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1952,6 +1952,28 @@ strlen_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
int count_vdef = 100;
do_invalidate (dombb, phi, visited, &count_vdef);
BITMAP_FREE (visited);
+ if (count_vdef == 0)
+ {
+ /* If there were too many vdefs in between immediate
+ dominator and current bb, invalidate everything.
+ If stridx_to_strinfo has been unshared, we need
+ to free it, otherwise just set it to NULL. */
+ if (!strinfo_shared ())
+ {
+ unsigned int i;
+ strinfo si;
+
+ for (i = 1;
+ vec_safe_iterate (stridx_to_strinfo, i, &si);
+ ++i)
+ {
+ free_strinfo (si);
+ (*stridx_to_strinfo)[i] = NULL;
+ }
+ }
+ else
+ stridx_to_strinfo = NULL;
+ }
break;
}
}