aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2013-01-08 15:10:44 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2013-01-08 15:10:44 +0100
commit4267a4a6ce7a778a24e50fa36106ad0672aeb424 (patch)
treebf20a1a93aced6f048f916251195f06361aa0722
parent80a8d5212e6f3841c5c20a04f3b479d4fb6f9b9d (diff)
downloadgcc-4267a4a6ce7a778a24e50fa36106ad0672aeb424.zip
gcc-4267a4a6ce7a778a24e50fa36106ad0672aeb424.tar.gz
gcc-4267a4a6ce7a778a24e50fa36106ad0672aeb424.tar.bz2
re PR debug/55579 (SRA doesn't create debug stmts when they would be useful)
2013-01-08 Martin Jambor <mjambor@suse.cz> PR debug/55579 * tree-sra.c (analyze_access_subtree): Return true also after potentially creating a debug-only replacement. testsuite/ * gcc.dg/tree-ssa/pr55579.c: New test. From-SVN: r195015
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr55579.c14
-rw-r--r--gcc/tree-sra.c35
4 files changed, 42 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d9f569..a4c8481 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-08 Martin Jambor <mjambor@suse.cz>
+
+ PR debug/55579
+ * tree-sra.c (analyze_access_subtree): Return true also after
+ potentially creating a debug-only replacement.
+
2013-01-08 Jakub Jelinek <jakub@redhat.com>
PR middle-end/55890
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a0bdd9e..5d6acaf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-08 Martin Jambor <mjambor@suse.cz>
+
+ PR debug/55579
+ * gcc.dg/tree-ssa/pr55579.c: New test.
+
2013-01-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* g++.dg/debug/dwarf2/pr54508.C: Allow for more whitespace after
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c
new file mode 100644
index 0000000..a4f1825
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -fdump-tree-esra" } */
+
+struct S { int a; char b; char c; short d; };
+
+int
+foo (int x)
+{
+ struct S s = { x + 1, x + 2, x + 3, x + 4 };
+ char *p = &s.c;
+ return x;
+}
+
+/* { dg-final { scan-tree-dump "Created a debug-only replacement for s" "esra" } } */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 9c75393..af5a36e 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2197,20 +2197,25 @@ analyze_access_subtree (struct access *root, struct access *parent,
}
else
{
- if (MAY_HAVE_DEBUG_STMTS && allow_replacements
+ if (allow_replacements
&& scalar && !root->first_child
&& (root->grp_scalar_write || root->grp_assignment_write))
{
gcc_checking_assert (!root->grp_scalar_read
&& !root->grp_assignment_read);
- root->grp_to_be_debug_replaced = 1;
- if (dump_file && (dump_flags & TDF_DETAILS))
+ sth_created = true;
+ if (MAY_HAVE_DEBUG_STMTS)
{
- fprintf (dump_file, "Marking ");
- print_generic_expr (dump_file, root->base, 0);
- fprintf (dump_file, " offset: %u, size: %u ",
- (unsigned) root->offset, (unsigned) root->size);
- fprintf (dump_file, " to be replaced with debug statements.\n");
+ root->grp_to_be_debug_replaced = 1;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Marking ");
+ print_generic_expr (dump_file, root->base, 0);
+ fprintf (dump_file, " offset: %u, size: %u ",
+ (unsigned) root->offset, (unsigned) root->size);
+ fprintf (dump_file, " to be replaced with debug "
+ "statements.\n");
+ }
}
}
@@ -2220,17 +2225,11 @@ analyze_access_subtree (struct access *root, struct access *parent,
root->grp_total_scalarization = 0;
}
- if (sth_created
- && (!hole || root->grp_total_scalarization))
- {
- root->grp_covered = 1;
- return true;
- }
- if (root->grp_write || TREE_CODE (root->base) == PARM_DECL)
+ if (!hole || root->grp_total_scalarization)
+ root->grp_covered = 1;
+ else if (root->grp_write || TREE_CODE (root->base) == PARM_DECL)
root->grp_unscalarized_data = 1; /* not covered and written to */
- if (sth_created)
- return true;
- return false;
+ return sth_created;
}
/* Analyze all access trees linked by next_grp by the means of