From patchwork Tue Jul 10 01:11:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 941763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481251-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Ob20vjEg"; dkim-atps=neutral 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 41Pjj10gcKz9s0W for ; Tue, 10 Jul 2018 10:28:04 +1000 (AEST) 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:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=T0NF8Gy8j+9vRrrHUGrImVD9uBhzYWrwuZs/QTyvWy7IoG2hwPvNg 53rwvqzIPLt9hN/BShqQJPFjBdsiWkfJOdzXqRePouVAwQVSoJ+gpYX4+Gvu3iTQ uN8y1JSvZhimey52Vw5CXv1WSng1+mfoAWMchXy8iPZJ2J3mAOKvek= 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:cc:subject:date:message-id:in-reply-to:references; s= default; bh=ZsPo/IPgpV1AYnkwa9mDEp7JPsk=; b=Ob20vjEg/ECmTGfGGfmf /WHLuiLqjxybwC1fv/guV4w/q+EkkFYSLdOwj1gDtZfwF+XkSbwSrZdGNIf1cjBj HPYm5qKxkyG8tj46+dsNUNbrHEAOqmRTvOVCQ12xhuOSlz30VVuAZpCgmoG4po9T Ks3+pVyWLz4Q5ygcPBtVKSQ= Received: (qmail 85647 invoked by alias); 10 Jul 2018 00:27:34 -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 85500 invoked by uid 89); 10 Jul 2018 00:27:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2601 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 00:27:32 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59BF7C049E0F; Tue, 10 Jul 2018 00:27:31 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-31.phx2.redhat.com [10.3.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id F06EC600C9; Tue, 10 Jul 2018 00:27:29 +0000 (UTC) From: David Malcolm To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Richard Sandiford , David Malcolm Subject: [PATCH 2/5] Use opt-problem.h in try_vectorize_loop_1 Date: Mon, 9 Jul 2018 21:11:33 -0400 Message-Id: <1531185096-17113-3-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1531185096-17113-1-git-send-email-dmalcolm@redhat.com> References: <1531185096-17113-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes gcc/ChangeLog: * tree-vectorizer.c: Include "opt-problem.h". (try_vectorize_loop_1): Convert "loop_vinfo" from loop_vec_info to opt_loop_vec_info loop_vinfo, and use opt_report to report any opt_problem thus captured. Use opt_report ro report on successful loop vectorization. --- gcc/tree-vectorizer.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 8d54fbb..c60d0d9 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "attribs.h" #include "gimple-pretty-print.h" +#include "opt-problem.h" /* Loop or bb location, with hotness information. */ @@ -705,9 +706,17 @@ try_vectorize_loop_1 (hash_table *&simduid_to_vf_htab, LOCATION_FILE (vect_location.get_location_t ()), LOCATION_LINE (vect_location.get_location_t ())); - loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo, &shared); + opt_loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo, &shared); loop->aux = loop_vinfo; + if (!loop_vinfo) + if (loop_vinfo.get_problem ()) + { + opt_report report; + if (report.remark (vect_location, "couldn't vectorize loop")) + loop_vinfo.get_problem ()->report_reason (report); + } + if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo)) { /* Free existing information if loop is analyzed with some @@ -775,13 +784,26 @@ try_vectorize_loop_1 (hash_table *&simduid_to_vf_htab, unsigned HOST_WIDE_INT bytes; if (current_vector_size.is_constant (&bytes)) - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized vectorized using " + { + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "loop vectorized vectorized using " + HOST_WIDE_INT_PRINT_UNSIGNED " byte " + "vectors\n", bytes); + opt_report report; + // FIXME: is this the correct format code? + report.remark (vect_location, + "loop vectorized using " HOST_WIDE_INT_PRINT_UNSIGNED " byte " - "vectors\n", bytes); + "vectors", bytes); + } else - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized using variable length vectors\n"); + { + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "loop vectorized using variable length vectors\n"); + opt_report report; + report.remark (vect_location, + "loop vectorized using variable length vectors"); + } loop_p new_loop = vect_transform_loop (loop_vinfo); (*num_vectorized_loops)++;