From patchwork Sat Sep 16 20:39:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 112819 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2067705qgf; Sat, 16 Sep 2017 13:40:16 -0700 (PDT) X-Received: by 10.84.231.138 with SMTP id g10mr31171037plk.263.1505594416931; Sat, 16 Sep 2017 13:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505594416; cv=none; d=google.com; s=arc-20160816; b=ZOgCW+IGZlug9+cYicMyRKSN7zhu3wfei+uyuvHrEt5uqL7QP9UpX+wG49mcPWPPdF iunETAnkCHFdX42pVMKUAtM3Fr75gQEyzBr+0pXmgYAb8Wd28TMNKGk03MRfupFRuYC4 u/YhpUlmnkTQv/yx00LamwOnrVMstG/GhwmgPpekOAKQpocxKAge4O5WAG3g9hxu/vAm UYXB4ToNoo8p6Bhg1acVh/IoBLTOKS3oTNy9olhDas4zjBpNgJ8cIkHnwRvXH2/VSwBg H1BmXFlwtnWf9w+/1IDUqM9DnwOtnyGdYZExwfAMFefdQ8oSayEP/T2rU0Ki8Ds2c2R6 1dlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=zHeFhj8nDhQZv8CypNl781ZgEENgtK0s+BmR/mPGarI=; b=q6W0GxpWF7CrBlIdH8j4u8aSs+1sTVsuq+y3TBu9clQTPWz7NZEQ1UjBJyKCsPz1Pz xpfyoEtlStd8AebxDmHRkEoDK74tM46KZd2q8orAnpSzm0kL+8rdeOCBCf5ZHkF3T4s5 s+BZhO8uQvMoGbTu7X90JHI4oG03MMzVCZPdpa1qGNWRasKmeaol0+inSAp/HzMU0/Q4 3X6TnzIf2GxFKbp2MEf9vlyz4qRby2GgeO7qLcM7ysXLIqdvelpxsHAsDLsKGYQz1rap BLOb3NiY4DevmxjGmJHyhsCsBMqUN3CzDAxOHS19M5nfo215i6KpGCavY97x6Ko1A08E XKgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fWTq3LSY; spf=pass (google.com: domain of gcc-patches-return-462314-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462314-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b4si71040pfh.192.2017.09.16.13.40.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2017 13:40:16 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-462314-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fWTq3LSY; spf=pass (google.com: domain of gcc-patches-return-462314-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-462314-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=QFVIXSHWJ9D6Kf904f7a9K2O7ME/wdHgzPqKD8sfQVAkkfRGmM9qZ /s6vBVo011viUJUeOiyzUwUtiV34MVE+pHGCKKM+3WOFa4lebJj1CdyUMbu6fHHF dMXLKVdVh6OoD0f4va5PTz5ILSSD6w1A8iZ/JjIP08hPwJL+mWP7DI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=U4/63bUODup+nz8St1NEWYnQg5c=; b=fWTq3LSYQLzKfYjrXeVx uwZuR+vljW7wFNadm6gO2+sh+r60AsTh14e1gCtX2Yia1KcVxCqwRLL4ESVyUFOH 5udaW2z/aMmfiLa5bwrD5m9llIzU3EdVciJKRYAnD9ltQs0bqvpf2hiPKFqIS8aS X+kiXs2NSQ+sMRZIgvFqaug= Received: (qmail 101982 invoked by alias); 16 Sep 2017 20:40:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101404 invoked by uid 89); 16 Sep 2017 20:40:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1589, HX-Received:10.223.185.5, opportunity X-HELO: mail-wr0-f173.google.com Received: from mail-wr0-f173.google.com (HELO mail-wr0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Sep 2017 20:40:01 +0000 Received: by mail-wr0-f173.google.com with SMTP id r74so3798357wrb.13 for ; Sat, 16 Sep 2017 13:40:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=zHeFhj8nDhQZv8CypNl781ZgEENgtK0s+BmR/mPGarI=; b=hn20+QhlblBCu4w1P4/7FKV3yiTdzEgX15Uu58VJJ6oAKSuebG78Lvw4bIfqwOR05N 2fSBM5XTVs+LSLtuTPtBu6ZV1G2chOcWImLwbR/cCrkjOSmNBfBjfn9sCEX+HvSrfz82 T89XKZgUFsu6z5pUgdbPwitt6JJfF9TkEbuofTBTEiHtWULDpc9wAOOynmFhjtaBfQBB OM0/dlA1Xo7YKQrRvS59Nad/y/7CLkz50A1Z9mDINeGobVfYEchPhwPMjfltGW2sZKmU qMv8GDo2QJqfylkbzu3mz5zV7E6Q2G5HZoUtzMoys75XgYpfVsfHsROD5QFa9+ot5uOk MInw== X-Gm-Message-State: AHPjjUgtQgGsMU+cuQGthHA+DcvPHTi7ULO4iub3OpRQkjMW8QTJAvF9 CScPA+FwBbaX3d6e0dy/Tw== X-Google-Smtp-Source: ADKCNb4TGTbyuquPj4Xe3A9T1z5LdBiBPlqMQ+FtmIQfCbWL0Snp2Z91pcXu5NCvQY3bVKpk1/3rtA== X-Received: by 10.223.185.5 with SMTP id k5mr20498397wrf.189.1505594399432; Sat, 16 Sep 2017 13:39:59 -0700 (PDT) Received: from localhost ([2.25.234.0]) by smtp.gmail.com with ESMTPSA id q188sm4371735wmb.43.2017.09.16.13.39.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Sep 2017 13:39:58 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [committed] PR82228: Move ncopies calculation in vectorizable_live_operation Date: Sat, 16 Sep 2017 21:39:56 +0100 Message-ID: <87k20ynzs3.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 ...which should have been after the early exit for non-vectorised statements. (Actually it could be after the !vec_stmt test in current sources, but one of the later SVE patches needs it to be before, and that's also the standard position in other vectorizable_* routines.) Tested on x86_64-linux-gnu and applied as obvious. It might be difficult to construct a reliable C or Fortran test for this, since it only triggers if we miss a sinking opportunity. A gimple FE test might work though. I'll try that when I have more time, but I didn't want to hold the patch up until then. Thanks, Richard 2017-09-16 Richard Sandiford gcc/ PR tree-optimization/82228 * tree-vect-loop.c (vectorizable_live_operation): Move initialization of ncopies. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c 2017-09-15 13:03:19.144141117 +0100 +++ gcc/tree-vect-loop.c 2017-09-16 21:30:38.351984079 +0100 @@ -7029,11 +7029,6 @@ vectorizable_live_operation (gimple *stm gcc_assert (STMT_VINFO_LIVE_P (stmt_info)); - if (slp_node) - ncopies = 1; - else - ncopies = vect_get_num_copies (loop_vinfo, vectype); - if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def) return false; @@ -7054,6 +7049,11 @@ vectorizable_live_operation (gimple *stm return true; } + if (slp_node) + ncopies = 1; + else + ncopies = vect_get_num_copies (loop_vinfo, vectype); + if (!vec_stmt) /* No transformation required. */ return true;