public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-71] tree-optimization/44794 - avoid excessive RTL unrolling on epilogues
@ 2023-04-19 11:51 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-19 11:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a243ce2a52a6c62bc0d6be0b756a85dd9c1bceb7

commit r14-71-ga243ce2a52a6c62bc0d6be0b756a85dd9c1bceb7
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Mar 9 09:02:07 2023 +0100

    tree-optimization/44794 - avoid excessive RTL unrolling on epilogues
    
    The following adjusts tree_[transform_and_]unroll_loop to set an
    upper bound on the number of iterations on the epilogue loop it
    creates.  For the testcase at hand which involves array prefetching
    this avoids applying RTL unrolling to them when -funroll-loops is
    specified.
    
    Other users of this API includes predictive commoning and
    unroll-and-jam.
    
            PR tree-optimization/44794
            * tree-ssa-loop-manip.cc (tree_transform_and_unroll_loop):
            If an epilogue loop is required set its iteration upper bound.

Diff:
---
 gcc/tree-ssa-loop-manip.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc
index 4ef27bae515..a52277abdbf 100644
--- a/gcc/tree-ssa-loop-manip.cc
+++ b/gcc/tree-ssa-loop-manip.cc
@@ -1297,6 +1297,12 @@ tree_transform_and_unroll_loop (class loop *loop, unsigned factor,
 	}
 
       remove_path (exit);
+
+      /* The epilog loop latch executes at most factor - 1 times.
+	 Since the epilog is entered unconditionally it will need to handle
+	 up to factor executions of its body.  */
+      new_loop->any_upper_bound = 1;
+      new_loop->nb_iterations_upper_bound = factor - 1;
     }
   else
     new_exit = single_dom_exit (loop);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-19 11:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 11:51 [gcc r14-71] tree-optimization/44794 - avoid excessive RTL unrolling on epilogues Richard Biener

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).