From patchwork Tue Aug 31 10:26:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1522522 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=cdEUo8O+; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4GzNg93rlDz9sW4 for ; Tue, 31 Aug 2021 20:27:48 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2E10385840A for ; Tue, 31 Aug 2021 10:27:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2E10385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1630405665; bh=7mODo3SDbru/7J8LlvfM1EyrxZKCnXyRqQ0nTe0qN4Y=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=cdEUo8O+61JGUekImXObEevXz2vgYgMv7p+OD8iMJDYhAtvJyqTqsuWp0ViCeM3aR TDX6R78Ie3qW/6H52Aylxb13veWpbKSV/wg2I8q+z+Dz8kOR0i9bnPOV3zWYCZ9+U4 O57iWuWwdDoEYc6qWrojIUsxD22/E2Jws+7J+ebs= 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 [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id CDB3E3858401 for ; Tue, 31 Aug 2021 10:26:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDB3E3858401 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 957672213F for ; Tue, 31 Aug 2021 10:26:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7A23713AC9 for ; Tue, 31 Aug 2021 10:26:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id H3QoHO4DLmEQVwAAMHmgww (envelope-from ) for ; Tue, 31 Aug 2021 10:26:54 +0000 Date: Tue, 31 Aug 2021 12:26:54 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/102142 - fix typo in loop BB reduc cost adjustment Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This fixes a typo in the condition guarding the cleanup of the visited flag of costed scalar stmts. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-08-31 Richard Biener PR tree-optimization/102142 * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Fix condition under which to unset the visited flag. * g++.dg/torture/pr102142.C: New testcase. --- gcc/testsuite/g++.dg/torture/pr102142.C | 9 +++++++++ gcc/tree-vect-slp.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr102142.C diff --git a/gcc/testsuite/g++.dg/torture/pr102142.C b/gcc/testsuite/g++.dg/torture/pr102142.C new file mode 100644 index 00000000000..8e3ea5d96b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr102142.C @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +extern short arr_597[]; +extern bool arr_601[]; +int test_var_13; +void test(short arr_391[][9][2][2]) { + for (int i_60 = 0; i_60 < 11; i_60 += test_var_13) + arr_597[22] = arr_601[i_60] = arr_391[0][0][1][4]; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 4ca24408249..fa3566f3d06 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -5396,7 +5396,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo, /* Unset visited flag. This is delayed when the subgraph is profitable and we process the loop for remaining unvectorized if-converted code. */ - if (orig_loop && !profitable) + if (!orig_loop || !profitable) FOR_EACH_VEC_ELT (scalar_costs, i, cost) gimple_set_visited (cost->stmt_info->stmt, false);