From patchwork Fri Feb 5 10:58:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1436585 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; 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=VQY92uIV; dkim-atps=neutral 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 4DXC873qdZz9sWW for ; Fri, 5 Feb 2021 21:58:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6F3FE385DC33; Fri, 5 Feb 2021 10:58:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F3FE385DC33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1612522705; bh=kJGiSLvij0Drc4PE4V3m8IT+sW+Lmee5rmb6MOHo9Yw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=VQY92uIVnANQTk6p3muC2Wu5LWAZRTl+7euYJdqDoR8NnQe7tNTUE9IciXqu4/gKR c/MxfEv7ygTi+FjCRiYCPBlM9xlTjgUYfSa+dFcIATY885Z5r8OGc010LBuqJqKQl+ zW4e6CNjvB4GN7439PWnJEGT8DGNCgwEAzZmQVy8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id A4A5B3857020 for ; Fri, 5 Feb 2021 10:58:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A4A5B3857020 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 03DCCD6E; Fri, 5 Feb 2021 02:58:23 -0800 (PST) Received: from [10.57.9.222] (unknown [10.57.9.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6C7293F73B; Fri, 5 Feb 2021 02:58:22 -0800 (PST) To: "gcc-patches@gcc.gnu.org" Subject: PR98974: Fix vectorizable_condition after STMT_VINFO_VEC_STMTS Message-ID: <226fc0cc-1068-fea9-b45c-b79dc022b5d6@arm.com> Date: Fri, 5 Feb 2021 10:58:20 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HTML_MESSAGE, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Cc: Richard Sandiford , Richard Biener Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, As mentioned in the PR, this patch fixes up the nvectors parameter passed to vect_get_loop_mask in vectorizable_condition. Before the STMT_VINFO_VEC_STMTS rework we used to handle each ncopy separately, now we gather them all at the same time and don't need to multiply vec_num with ncopies. The reduced testcase I used to illustrate the issue in the PR gives a warning, if someone knows how to get rid of that (it's Fortran) I'd include it as a testcase for this. Bootstrapped and regression tested on aarch64-none-linux-gnu. I don't believe that code triggers for other targets, so not sure it makes sense to test on others? Is this OK for trunk? Would you rather wait for the testcase? gcc/ChangeLog: 2021-02-05 Andre Vieira PR middle-end/98974 * tree-vect-stmts.c (vectorizable_condition): Fix nvectors parameter for vect_get_loop_mask call. diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 0bc1cb1c5b4f6c1f0447241b4d31434bf7cca1a4..d07602f6d38f9c51936ac09942599fc5a14f46ab 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10237,8 +10237,7 @@ vectorizable_condition (vec_info *vinfo, { unsigned vec_num = vec_oprnds0.length (); tree loop_mask - = vect_get_loop_mask (gsi, masks, vec_num * ncopies, - vectype, i); + = vect_get_loop_mask (gsi, masks, vec_num, vectype, i); tree tmp2 = make_ssa_name (vec_cmp_type); gassign *g = gimple_build_assign (tmp2, BIT_AND_EXPR, vec_compare,