From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69281 invoked by alias); 23 Oct 2017 17:25:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 68950 invoked by uid 89); 23 Oct 2017 17:25:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=N1, 061 X-HELO: mail-wr0-f179.google.com Received: from mail-wr0-f179.google.com (HELO mail-wr0-f179.google.com) (209.85.128.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:25:25 +0000 Received: by mail-wr0-f179.google.com with SMTP id r79so18182644wrb.13 for ; Mon, 23 Oct 2017 10:25:24 -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:references:date :in-reply-to:message-id:user-agent:mime-version; bh=UUHfuPyefdBDs/M8znGJ5LR2EngMx3f2YOFLyj8gUL4=; b=VYC0lJKkV7wy230xoiVmRt8Z0skBTBVK6q0bzMuXtKinqcYLyLw4wllJeb64GV7Znb 7c6zD096vZSJnes6C0bGoMnlrbi8o4iiqmwgVY71Siw2kKXI8uumYuY7CmJHnZ1CImqm ySXRw741XReuNCuDeHWZFnwn7gvWHcGD2/xZbtZJphTwlU+2siDpRpB4+vD/eXjtVful Nl0qzRSKeMXqXVMmvav1s+CLW8ogt0l5ks8bxoVvxT+ern+Enr/y+n9LeSADyBSbQ74h eXhUdo/fLl3r6rElD6ea6Wjl6zcgBHeoSxV04qzFa2Dy/clq05Fokz9CkLjtxVzmzgEA Z9yw== X-Gm-Message-State: AMCzsaVLDbz+9YUbgZSCF6Xsx7Xdr1JL0Sv85qoEjeyt6WpHREy9lS0I w9q9ZuD+qVwpkJ7gyoswXcwdN56yZ40= X-Google-Smtp-Source: ABhQp+Q/jn7prytfx0tm+kB2I6YOQOjtz6zsIxwutCDmfMOZpnuS5zHneALT0cBVPB0z4LPlR1VhkQ== X-Received: by 10.223.160.86 with SMTP id l22mr3067214wrl.187.1508779522882; Mon, 23 Oct 2017 10:25:22 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id m19sm3610310wma.24.2017.10.23.10.25.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:25:22 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [061/nnn] poly_int: compute_data_ref_alignment References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 17:25:00 -0000 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87k1zlkc8u.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01562.txt.bz2 This patch makes vect_compute_data_ref_alignment treat DR_INIT as a poly_int and handles cases in which the calculated misalignment might not be constant. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Treat drb->init as a poly_int. Fail if its misalignment wrt vector_alignment isn't known. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c 2017-10-23 17:22:18.234826257 +0100 +++ gcc/tree-vect-data-refs.c 2017-10-23 17:22:24.456074525 +0100 @@ -944,8 +944,8 @@ vect_compute_data_ref_alignment (struct DR_VECT_AUX (dr)->base_misaligned = true; base_misalignment = 0; } - unsigned int misalignment = (base_misalignment - + TREE_INT_CST_LOW (drb->init)); + poly_int64 misalignment + = base_misalignment + wi::to_poly_offset (drb->init).force_shwi (); /* If this is a backward running DR then first access in the larger vectype actually is N-1 elements before the address in the DR. @@ -955,7 +955,21 @@ vect_compute_data_ref_alignment (struct misalignment += ((TYPE_VECTOR_SUBPARTS (vectype) - 1) * TREE_INT_CST_LOW (drb->step)); - SET_DR_MISALIGNMENT (dr, misalignment & (vector_alignment - 1)); + unsigned int const_misalignment; + if (!known_misalignment (misalignment, vector_alignment, + &const_misalignment)) + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Non-constant misalignment for access: "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, ref); + dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); + } + return true; + } + + SET_DR_MISALIGNMENT (dr, const_misalignment); if (dump_enabled_p ()) {