public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/5][tree-sra.c] PR/63679 Make SRA replace constant pool loads
@ 2015-08-25 11:06 Alan Lawrence
  2015-08-25 11:06 ` [RFC 4/5] Handle constant-pool entries Alan Lawrence
                   ` (4 more replies)
  0 siblings, 5 replies; 46+ messages in thread
From: Alan Lawrence @ 2015-08-25 11:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: rguenther, mjambor

ssa-dom-cse-2.c fails on a number of platforms because the input array is pushed
out to the constant pool, preventing later stages from folding away the entire
computation. This patch series fixes the failure by extending SRA to pull the
constants back in.

This is my first patch(set) to SRA and as such I'd appreciate suggestions about
the approach. I think the first two patches, which essentially just extend SRA
to deal with ARRAY_TYPE as well as RECORD_TYPE, are fairly straightforward and
may stand alone. Later patches, in particular, may be better done in a different
way and I'd welcome feedback as to what a patch (series) should look like.

Also the heuristic for controlling SRA, when dealing with constant-pool loads,
may want something better/other than the default
--param sra-max-scalarization-size-O{speed,size}, or else platforms where the
initializer is forced to memory, will still suffer in terms of constant
propagation.

^ permalink raw reply	[flat|nested] 46+ messages in thread
* Re: [PATCH 1/5] Refactor completely_scalarize_var
@ 2015-08-27 15:41 Alan Lawrence
  0 siblings, 0 replies; 46+ messages in thread
From: Alan Lawrence @ 2015-08-27 15:41 UTC (permalink / raw)
  To: martin.jambor; +Cc: gcc-patches, rguenther

Martin Jambor wrote:
>
> If you change what the function does, you have to change the comment
> too.  If I am not mistaken, even with the whole patch set applied, the
> first sentence would still be: "Create total_scalarization accesses
> for all scalar type fields in VAR and for VAR as a whole." And with
> this change, only the part after "and" will remain true.

Ah, thanks, I had misunderstood.  I've deleted the bit before the 'and' and
pushed the attached as r227264.

Thanks, Alan
---
 gcc/tree-sra.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 818c290..8b3a0ad 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -980,12 +980,11 @@ completely_scalarize_record (tree base, tree decl, HOST_WIDE_INT offset,
       }
 }
 
-/* Create total_scalarization accesses for all scalar type fields in VAR and
-   for VAR as a whole.  VAR must be of a RECORD_TYPE conforming to
-   type_consists_of_records_p.   */
+/* Create a total_scalarization access for VAR as a whole.  VAR must be of a
+   RECORD_TYPE conforming to type_consists_of_records_p.  */
 
 static void
-completely_scalarize_var (tree var)
+create_total_scalarization_access (tree var)
 {
   HOST_WIDE_INT size = tree_to_uhwi (DECL_SIZE (var));
   struct access *access;
@@ -994,8 +993,6 @@ completely_scalarize_var (tree var)
   access->expr = var;
   access->type = TREE_TYPE (var);
   access->grp_total_scalarization = 1;
-
-  completely_scalarize_record (var, var, 0, var);
 }
 
 /* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it.  */
@@ -2529,7 +2526,8 @@ analyze_all_variable_accesses (void)
 	    if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
 		<= max_scalarization_size)
 	      {
-		completely_scalarize_var (var);
+		create_total_scalarization_access (var);
+		completely_scalarize_record (var, var, 0, var);
 		if (dump_file && (dump_flags & TDF_DETAILS))
 		  {
 		    fprintf (dump_file, "Will attempt to totally scalarize ");
-- 
1.8.3

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2015-09-18  8:36 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25 11:06 [PATCH 0/5][tree-sra.c] PR/63679 Make SRA replace constant pool loads Alan Lawrence
2015-08-25 11:06 ` [RFC 4/5] Handle constant-pool entries Alan Lawrence
2015-08-25 20:19   ` Jeff Law
2015-08-26  7:24     ` Richard Biener
2015-08-26 15:51     ` Alan Lawrence
2015-08-26 14:08   ` Martin Jambor
2015-08-25 11:06 ` [RFC 5/5] Always completely replace constant pool entries Alan Lawrence
2015-08-25 20:09   ` Jeff Law
2015-08-26  7:29     ` Richard Biener
2015-08-25 11:21 ` [PATCH 2/5] completely_scalarize arrays as well as records Alan Lawrence
2015-08-25 19:40   ` Jeff Law
2015-08-27 16:54     ` Fixing sra-12.c (was: Re: [PATCH 2/5] completely_scalarize arrays as well as records) Alan Lawrence
2015-08-27 20:58       ` Fixing sra-12.c Jeff Law
2015-08-25 21:44   ` [PATCH 2/5] completely_scalarize arrays as well as records Martin Jambor
2015-08-25 21:55     ` Jeff Law
2015-08-26  7:11       ` Richard Biener
2015-08-26  9:39         ` Martin Jambor
2015-08-26 10:12           ` Richard Biener
2015-08-26 16:30             ` Alan Lawrence
2015-08-26 19:18               ` Richard Biener
2015-08-27 16:00     ` Alan Lawrence
2015-08-28  7:19       ` Christophe Lyon
2015-08-28  8:06         ` Richard Biener
2015-08-28  8:16           ` Christophe Lyon
2015-08-28  8:31             ` Richard Biener
2015-08-28 10:09             ` Alan Lawrence
2015-08-28 13:35               ` Richard Biener
2015-08-28 14:05                 ` Alan Lawrence
2015-08-28 15:17                   ` Alan Lawrence
2015-09-07 13:20                     ` Alan Lawrence
2015-09-08 12:47                       ` Martin Jambor
2015-09-14 17:41                         ` Alan Lawrence
2015-09-15  7:49                           ` Richard Biener
2015-09-17 17:12                             ` Alan Lawrence
2015-09-18  8:36                               ` Richard Biener
2015-08-25 11:30 ` [PATCH 1/5] Refactor completely_scalarize_var Alan Lawrence
2015-08-25 19:36   ` Jeff Law
2015-08-25 21:42   ` Martin Jambor
2015-08-25 12:30 ` [PATCH 3/5] Build ARRAY_REFs when the base is of ARRAY_TYPE Alan Lawrence
2015-08-25 19:54   ` Jeff Law
2015-08-26  6:34     ` Bin.Cheng
2015-08-26  7:40       ` Richard Biener
2015-08-26  7:41         ` Bin.Cheng
2015-08-26  7:20     ` Richard Biener
2015-08-25 22:51   ` Martin Jambor
2015-08-27 15:41 [PATCH 1/5] Refactor completely_scalarize_var Alan Lawrence

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).