From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id C43A83858D39; Wed, 19 Apr 2023 11:51:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C43A83858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681905085; bh=NEKkrHY3XbnIlccHiptTuZtZHyupGErAPn1PrzFzofA=; h=From:To:Subject:Date:From; b=PaRQLCsXtXe+b1ztBzkCpM0dJJhNCpjeM0M43XbZ05JRElZXLKO6XJI4EAe9n7z6U VcQdMOlpfzDibIpNFehnYN36vAyqEW58NHqUbV78F4vQteKNXFuQwy1Kh/m2qmQx4V 6tW548eBT2yk0suaPrzfJvOQNZ5HcgmN+7QHyQlE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-71] tree-optimization/44794 - avoid excessive RTL unrolling on epilogues X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 6d7e0bcfa49e4ddc84dabe520bba8a023bc52692 X-Git-Newrev: a243ce2a52a6c62bc0d6be0b756a85dd9c1bceb7 Message-Id: <20230419115125.C43A83858D39@sourceware.org> Date: Wed, 19 Apr 2023 11:51:25 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a243ce2a52a6c62bc0d6be0b756a85dd9c1bceb7 commit r14-71-ga243ce2a52a6c62bc0d6be0b756a85dd9c1bceb7 Author: Richard Biener 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);