From patchwork Fri Jul 21 13:10:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 792111 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-458649-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.b="bQ13dsYe"; 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 3xDWN63l6Xz9s7M for ; Fri, 21 Jul 2017 23:10:30 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=f61YPL9I700eDp+5gkvF4+BtzXFoVLg4UeAxMDOp60N2UuKQNKtzE NIUSnPDd4LYOuCnHDHEhegpaSRXCyqDdmdj1e+5e1H13Tc+aWNqYxhCJvGIZN6Ch x6lIabAENMZLPUvmCQr9pdDYn8Pf86zfGCUQdtvj2CynumL8vPascw= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=r3ZgdMvztUmfu3Eq5CC/cWPS1c4=; b=bQ13dsYevKWgidm/OtGz C0ex2TWhKmrYuQ0ara4LIU19AwWl942LV3DFl8UeSL3yydI6VjDD7TjFYFeatwb8 YCyeXtOk+Q4XMiY2rV/06IKfxWJ0CwHoTdiUM3v2wfKpXyLgaO8C8uzfdCduoJyh FhlPgA2OePPeUGj192g67wo= Received: (qmail 83038 invoked by alias); 21 Jul 2017 13:10:17 -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 83017 invoked by uid 89); 21 Jul 2017 13:10:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jul 2017 13:10:15 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 06101ABBB for ; Fri, 21 Jul 2017 13:10:13 +0000 (UTC) Date: Fri, 21 Jul 2017 15:10:12 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH][3/n] Fix PR81303 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 When forcing versioning for the vector profitability check I noticed we use different niters for the peeling check than for the versioning one leading to two branches, the 2nd being redundant. The following makes that consistent, also using the known not overflown number of latch execution count. Bootstrap / regtest pending on x86_64-unknown-linux-gnu. Richard. 2017-06-21 Richard Biener PR tree-optimization/81303 * tree-vect-loop-manip.c (vect_loop_versioning): Build profitability check against LOOP_VINFO_NITERSM1. Index: gcc/tree-vect-loop-manip.c =================================================================== --- gcc/tree-vect-loop-manip.c (revision 250386) +++ gcc/tree-vect-loop-manip.c (working copy) @@ -2136,7 +2136,7 @@ vect_loop_versioning (loop_vec_info loop tree arg; profile_probability prob = profile_probability::likely (); gimple_seq gimplify_stmt_list = NULL; - tree scalar_loop_iters = LOOP_VINFO_NITERS (loop_vinfo); + tree scalar_loop_iters = LOOP_VINFO_NITERSM1 (loop_vinfo); bool version_align = LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo); bool version_alias = LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo); bool version_niter = LOOP_REQUIRES_VERSIONING_FOR_NITERS (loop_vinfo); @@ -2144,7 +2144,7 @@ vect_loop_versioning (loop_vec_info loop if (check_profitability) cond_expr = fold_build2 (GE_EXPR, boolean_type_node, scalar_loop_iters, build_int_cst (TREE_TYPE (scalar_loop_iters), - th)); + th - 1)); if (version_niter) vect_create_cond_for_niters_checks (loop_vinfo, &cond_expr);