From patchwork Thu Mar 9 10:37:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 66163 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D4516385781F for ; Thu, 9 Mar 2023 10:38:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4516385781F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678358286; bh=vvH2t67S9SE8AkWiS/s5oxnibAVnrRQ01m0m4uPzoUs=; h=Date:To:cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=BQ+QRvkK5TUKC5OnQTby8eCTE/wC0M8YhxOUK2SURbEpX8SzVxkCGqm2BJ/xubeRA SDm558QX/UpoUBiE1hpcBlRQlxuCqETyaHLiW4rYWaMaKJIcr0rY1h4LasDnjkF5uV N5XylLmf7YY+X/OdZfsXNezZTKW2bDnefmcqQD0g= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id D62A73850427 for ; Thu, 9 Mar 2023 10:37:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D62A73850427 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9BDAD21E25; Thu, 9 Mar 2023 10:37:13 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 715EB2C141; Thu, 9 Mar 2023 10:37:13 +0000 (UTC) Date: Thu, 9 Mar 2023 10:37:13 +0000 (UTC) To: gcc-patches@gcc.gnu.org cc: richard.sandiford@arm.com Subject: [PATCH] Avoid unnecessary epilogues from tree_unroll_loop User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20230309103806.D4516385781F@sourceware.org> The following fixes the condition determining whether we need an epilogue. When r12-2429-g62acc72a957b56 introduced this check I didn't notice the odd condition on review. Richard - do you remember if this was on purpose? I've noticed the mismatch with gcc.dg/tree-ssa/predcom-1.c for example. Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for stage1. Richard. * tree-ssa-loop-manip.cc (determine_exit_conditions): Fix no epilogue condition. --- gcc/tree-ssa-loop-manip.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc index c804a7353d5..a52277abdbf 100644 --- a/gcc/tree-ssa-loop-manip.cc +++ b/gcc/tree-ssa-loop-manip.cc @@ -1010,7 +1010,7 @@ determine_exit_conditions (class loop *loop, class tree_niter_desc *desc, /* Convert the latch count to an iteration count. */ tree niter = fold_build2 (PLUS_EXPR, type, desc->niter, build_one_cst (type)); - if (multiple_of_p (type, niter, bigstep)) + if (multiple_of_p (type, niter, build_int_cst (type, factor))) return; }