From patchwork Thu Dec 3 11:34:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1410341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CmtzX40Hqz9sVw for ; Thu, 3 Dec 2020 22:34:48 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D2303971809; Thu, 3 Dec 2020 11:34:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by sourceware.org (Postfix) with ESMTP id 737333860C3A for ; Thu, 3 Dec 2020 11:34:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 737333860C3A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=macro@linux-mips.org Received: from localhost.localdomain ([127.0.0.1]:34264 "EHLO localhost" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23992495AbgLCLenYdM7x (ORCPT ); Thu, 3 Dec 2020 12:34:43 +0100 Date: Thu, 3 Dec 2020 11:34:43 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/6] loop-iv: Add missing calls to `onlyjump_p' In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Ignore jumps that have side effects in loop processing as pasting the body of a loop multiple times within is semantically equivalent to jump deletion (between the iterations unrolled) even if we do not physically delete the jump RTL insn. gcc/ * loop-iv.c (simplify_using_initial_values): Only process jumps that match `onlyjump_p'. (check_simple_exit): Likewise. --- gcc/loop-iv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) gcc-loop-iv-only-jump.diff Index: gcc/gcc/loop-iv.c =================================================================== --- gcc.orig/gcc/loop-iv.c +++ gcc/gcc/loop-iv.c @@ -1936,7 +1936,7 @@ simplify_using_initial_values (class loo while (1) { insn = BB_END (e->src); - if (any_condjump_p (insn)) + if (any_condjump_p (insn) && onlyjump_p (insn)) { rtx cond = get_condition (BB_END (e->src), NULL, false, true); @@ -2887,7 +2887,7 @@ check_simple_exit (class loop *loop, edg return; /* It must end in a simple conditional jump. */ - if (!any_condjump_p (BB_END (exit_bb))) + if (!any_condjump_p (BB_END (exit_bb)) || !onlyjump_p (BB_END (exit_bb))) return; ein = EDGE_SUCC (exit_bb, 0);