This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

New SRA implementation


The previous SRA implementation had two unfortunate restrictions.

First, it couldn't handle nested aggregates, which severely limited
its usefullness when it comes to real-world code.  Including that
within gcc itself, e.g. block_stmt_iterator.

Second, it had a hard-coded limit of five fields per aggregate.

This is a complete rewrite to address both of these issues.  Nested
structures are handled.  Arrays are handled.  Arbitrary numbers of
fields are handled.

Extending to arbitrary numbers of fields means that we have to have
a good deal more smarts in deciding whether or not to instantiate
the fields.  I've come up with some preliminary heuristics that seem
to be not unreasonable, at least for the code within gcc and its
testsuites.  Surely more work is required here.

I havn't been able to measure a speed difference between the new and
old implementation that wasn't less than 1%, but for the record, 
bootstrap with the new implementation was u+s 175 out of 19181 seconds
faster to bootstrap.


r~


        * tree-sra.c: Rewrite from scratch.  Handle nested aggregates.
        * gcc.dg/tree-ssa/20040430-1.c: Expect zero if's.

Index: testsuite/gcc.dg/tree-ssa/20040430-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/20040430-1.c,v
retrieving revision 1.2
diff -u -p -r1.2 20040430-1.c
--- testsuite/gcc.dg/tree-ssa/20040430-1.c	13 May 2004 06:40:52 -0000	1.2
+++ testsuite/gcc.dg/tree-ssa/20040430-1.c	29 Jun 2004 16:17:10 -0000
@@ -1,7 +1,7 @@
 /* PR middle-end/14470.  Similar to
    gcc.c-torture/execute/20040313-1.c, but with a compile time test to
-   make sure the second if() is removed.  We should actually get rid
-   of the first if() too, but we're not that smart yet.  */
+   make sure the second if() is removed.  */
+/* Update: We now remove both ifs.  Whee. */
 
 /* { dg-do run } */
 /* { dg-options "-O2 -fdump-tree-optimized" } */
@@ -22,4 +22,4 @@ int main()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "if " 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "if " 0 "optimized"} } */

Attachment: tree-sra.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]