From patchwork Mon Dec 21 13:13:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 559548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3C385140313 for ; Tue, 22 Dec 2015 00:14:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=IxuLtCCt; dkim-atps=neutral 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:in-reply-to:references; q=dns; s= default; b=APHRrrtJuKQHJT7CkzxCXZcMF6/VCmM1M/psC4NeF5BRl4gKTptV3 Utb5VyzJyipd5syAPI4czTIkR9Fn5opaYqlO8L5tl99yCC11/m6zGWWvA5KfQx1T 1Huq26kGR0/zl5uaXLu1vnJKwF1pyERckyc8wLj4w0FAaRusThs9a4= 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:in-reply-to:references; s=default; bh=76W/e1Dl6iG1vc6DXqlJEuWuyjM=; b=IxuLtCCtBn1+1ovFAqNbW3E0MnvR gUlPoANmDBioAASOVcg6RAqSuigeW7gYS9W2QbEb74BPFODCI7yEAndCohRflD2/ rohHmvgzSOjYqf3gig+nas4+CW8ZWq4Yb7Y70lYAiFJkAEbeECLoWNhQ7TD/JGzO hu1HcVKBbuHOoqk= Received: (qmail 78581 invoked by alias); 21 Dec 2015 13:14:08 -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 78494 invoked by uid 89); 21 Dec 2015 13:14:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=77, reduction, Condition, them! X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Dec 2015 13:14:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4CFFA5B1 for ; Mon, 21 Dec 2015 05:13:37 -0800 (PST) Received: from arm.com (e105915-lin.emea.arm.com [10.2.206.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 460193F21A for ; Mon, 21 Dec 2015 05:14:03 -0800 (PST) From: Alan Lawrence To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/4] Add a pass_copy_prop following pass_ch_vect Date: Mon, 21 Dec 2015 13:13:27 +0000 Message-Id: <1450703608-8617-4-git-send-email-alan.lawrence@arm.com> In-Reply-To: <1450703608-8617-1-git-send-email-alan.lawrence@arm.com> References: <1450703608-8617-1-git-send-email-alan.lawrence@arm.com> X-IsSubscribed: yes This fixes the missed vectorization of gcc.dg/vect/pr65947-2.c following the previous patch, by cleaning up: i_49 = 1; ... goto ; : : <--- LOOP HEADER # i_53 = PHI into: : # i_53 = PHI Allowing scalar evolution and vectorization to proceed. A similar sequence of partial peeling, header-copying, and constant propagation also leads to pr65947-9.c successfully vectorizing (it previously didn't as the iteration count was too high) when inlined and so using known data. I'm not sure whether adding a pass_copy_prop is the right thing here, but since loop-header-copying can create such opportunities, it seems good to take them! gcc/ChangeLog: * passes.def: Add a pass_copy_prop following pass_ch_vect. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr65947-9.c: Add __attribute__ ((noinline)). --Alan --- gcc/passes.def | 1 + gcc/testsuite/gcc.dg/vect/pr65947-9.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/passes.def b/gcc/passes.def index 624d121..1043548 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -269,6 +269,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_expand_omp_ssa); POP_INSERT_PASSES () NEXT_PASS (pass_ch_vect); + NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_if_conversion); /* pass_vectorize must immediately follow pass_if_conversion. Please do not add any other passes in between. */ diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-9.c b/gcc/testsuite/gcc.dg/vect/pr65947-9.c index d0da13f..c7aac8d 100644 --- a/gcc/testsuite/gcc.dg/vect/pr65947-9.c +++ b/gcc/testsuite/gcc.dg/vect/pr65947-9.c @@ -7,7 +7,7 @@ extern void abort (void) __attribute__ ((noreturn)); /* Condition reduction with maximum possible loop size. Will fail to vectorize because the vectorisation requires a slot for default values. */ -char +__attribute__ ((noinline)) char condition_reduction (char *a, char min_v) { char last = -72;