public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1732] Fix builtin vs non-builtin partition merge in loop distribution
Date: Mon, 18 Jul 2022 12:43:29 +0000 (GMT)	[thread overview]
Message-ID: <20220718124329.311C73851C05@sourceware.org> (raw)

https://gcc.gnu.org/g:87f46a16ec05beb51439f55a4d3c36d64b95b00f

commit r13-1732-g87f46a16ec05beb51439f55a4d3c36d64b95b00f
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jul 18 13:09:57 2022 +0200

    Fix builtin vs non-builtin partition merge in loop distribution
    
    When r7-6373-g40b6bff965d004 fixed a costing issue it failed to
    make the logic symmetric which means that we now fuse
    normal vs. builtin when the cost model says so but we don't fuse
    builtin vs. normal.  The following fixes that, also allowing
    the cost model to decide to fuse two builtin partitions as otherwise
    an intermediate non-builtin can result in a partial merge as well.
    
            * tree-loop-distribution.cc (loop_distribution::distribute_loop):
            When computing cost-based merging do not disregard builtin
            classified partitions in some cases.
    
            * gcc.dg/tree-ssa/ldist-24.c: XFAIL.
            * gcc.dg/tree-ssa/ldist-36.c: Adjust expected outcome.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/ldist-24.c | 5 +++--
 gcc/testsuite/gcc.dg/tree-ssa/ldist-36.c | 3 ++-
 gcc/tree-loop-distribution.cc            | 5 +----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-24.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-24.c
index 75f7b8f0c88..2403a24293b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-24.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-24.c
@@ -20,5 +20,6 @@ void foo ()
       }
 }
 
-/* { dg-final { scan-tree-dump "generated memcpy" "ldist" } } */
-/* { dg-final { scan-tree-dump "generated memset zero" "ldist" } } */
+/* The cost modeling does not consider WAR as beneficial to split.  */
+/* { dg-final { scan-tree-dump "generated memcpy" "ldist" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "generated memset zero" "ldist" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-36.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-36.c
index 07393f0a665..6d560060e09 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-36.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-36.c
@@ -25,4 +25,5 @@ foo (struct st * restrict p)
     }
 }
 
-/* { dg-final { scan-tree-dump-times "Loop nest . distributed: split to 0 loops and 3 library" 1 "ldist" } } */
+/* The cost modeling doesn't consider splitting a WAR re-use profitable.  */
+/* { dg-final { scan-tree-dump-times "Loop nest . distributed: split to 1 loops and 1 library" 1 "ldist" } } */
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 0714bc41a43..0ee441c077d 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -3090,10 +3090,7 @@ loop_distribution::distribute_loop (class loop *loop,
   for (i = 0; partitions.iterate (i, &into); ++i)
     {
       bool changed = false;
-      if (partition_builtin_p (into) || into->kind == PKIND_PARTIAL_MEMSET)
-	continue;
-      for (int j = i + 1;
-	   partitions.iterate (j, &partition); ++j)
+      for (int j = i + 1; partitions.iterate (j, &partition); ++j)
 	{
 	  if (share_memory_accesses (rdg, into, partition))
 	    {


                 reply	other threads:[~2022-07-18 12:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220718124329.311C73851C05@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).