aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-02-19 19:30:22 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-02-19 19:30:22 +0100
commite19bcb67dd5942d598c282427f91437166dd565d (patch)
treedb800fe98bd9a288ba2a6bd2ff267e530c78e46d
parent8ac074e8e2e321aa7e73d416f4e598a2be89e8cd (diff)
downloadgcc-e19bcb67dd5942d598c282427f91437166dd565d.zip
gcc-e19bcb67dd5942d598c282427f91437166dd565d.tar.gz
gcc-e19bcb67dd5942d598c282427f91437166dd565d.tar.bz2
re PR debug/43084 (ICE -fipa-struct-reorg -g (VTA))
PR debug/43084 * ipa-struct-reorg.c (add_access_to_acc_sites): For debug stmts don't populate vars array. (create_new_general_access): For debug stmts just reset value. (get_stmt_accesses): For accesses within debug stmts just record them using add_access_to_acc_sites instead of preventing the peeling or counting them as accesses. * gcc.dg/pr43084.c: New test. From-SVN: r156904
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ipa-struct-reorg.c34
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr43084.c16
4 files changed, 59 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6423c36..850880a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2010-02-19 Jakub Jelinek <jakub@redhat.com>
+ PR debug/43084
+ * ipa-struct-reorg.c (add_access_to_acc_sites): For debug stmts don't
+ populate vars array.
+ (create_new_general_access): For debug stmts just reset value.
+ (get_stmt_accesses): For accesses within debug stmts just record them
+ using add_access_to_acc_sites instead of preventing the peeling or
+ counting them as accesses.
+
PR middle-end/42233
* dojump.c (do_jump) <case TRUTH_NOT_EXPR>: Invert priority.
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index bef303e..66b3ab4 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -1,5 +1,5 @@
/* Struct-reorg optimization.
- Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Olga Golovanevsky <olga@il.ibm.com>
(Initial version of this code was developed
by Caroline Tice and Mostafa Hagog.)
@@ -497,13 +497,16 @@ add_access_to_acc_sites (gimple stmt, tree var, htab_t accs)
acc = (struct access_site *) xmalloc (sizeof (struct access_site));
acc->stmt = stmt;
- acc->vars = VEC_alloc (tree, heap, 10);
+ if (!is_gimple_debug (stmt))
+ acc->vars = VEC_alloc (tree, heap, 10);
+ else
+ acc->vars = NULL;
slot = htab_find_slot_with_hash (accs, stmt,
htab_hash_pointer (stmt), INSERT);
*slot = acc;
-
}
- VEC_safe_push (tree, heap, acc->vars, var);
+ if (!is_gimple_debug (stmt))
+ VEC_safe_push (tree, heap, acc->vars, var);
}
/* This function adds NEW_DECL to function
@@ -1383,6 +1386,13 @@ create_new_general_access (struct access_site *acc, d_str str)
create_new_stmts_for_cond_expr (stmt);
break;
+ case GIMPLE_DEBUG:
+ /* It is very hard to maintain usable debug info after struct peeling,
+ for now just reset all debug stmts referencing objects that have
+ been peeled. */
+ gimple_debug_bind_reset_value (stmt);
+ break;
+
default:
create_new_stmts_for_general_acc (acc, str);
}
@@ -2494,6 +2504,15 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
if (i != VEC_length (structure, structures))
{
+ if (is_gimple_debug (stmt))
+ {
+ d_str str;
+
+ str = VEC_index (structure, structures, i);
+ add_access_to_acc_sites (stmt, NULL, str->accs);
+ *walk_subtrees = 0;
+ break;
+ }
if (dump_file)
{
fprintf (dump_file, "\nThe type ");
@@ -2525,6 +2544,13 @@ get_stmt_accesses (tree *tp, int *walk_subtrees, void *data)
struct field_entry * field =
find_field_in_struct (str, field_decl);
+ if (is_gimple_debug (stmt))
+ {
+ add_access_to_acc_sites (stmt, NULL, str->accs);
+ *walk_subtrees = 0;
+ break;
+ }
+
if (field)
{
struct field_access_site *acc = make_field_acc_node ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ff44628..14b2ea4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/43084
+ * gcc.dg/pr43084.c: New test.
+
2010-02-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42916
diff --git a/gcc/testsuite/gcc.dg/pr43084.c b/gcc/testsuite/gcc.dg/pr43084.c
new file mode 100644
index 0000000..a590fa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr43084.c
@@ -0,0 +1,16 @@
+/* PR debug/43084 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fipa-struct-reorg -fwhole-program -fipa-type-escape -fcompare-debug" } */
+
+struct S
+{
+ int a;
+};
+
+int
+main ()
+{
+ struct S s;
+ struct S *p = &s;
+ return p->a;
+}