From patchwork Mon Oct 23 17:05:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829434 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-464789-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="JY21sXHg"; 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 3yLN7y5Y97z9t6C for ; Tue, 24 Oct 2017 04:05:34 +1100 (AEDT) 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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=g4588gdUD9BkHpV0VhhvzeXbIaJi1 +SFuANBUapl+DZvVtmWIYMB6Ifm+KC0+0oPBME5nJ9JSuqXMM7iFyc3o2GVlJiw+ dSqghqHW+DZHqF6oyd0hZXA0QX4rwO9IKbfycC2aslcTrlLC8ORPtmRSzoaSmXgQ qR/1tMhCr27MHk= 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:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=Mc+z6MecTWiI8A748ZQ14ReUx3A=; b=JY2 1sXHgo4oRV9OvAreOmBBJjqa2r28n1mEoP/CXhgIBmqOug58+1vtgHVYDNPRFs2P 5r1pVrsfwn+T6UQ/N+2Kmi34pKHoS+36tDeT92YoV0ZLVT4Mo2VWwd0ZRW3KGTRE 4rmyCHCQS6woxKZuO33V6aeXHCasn7kP/BBcS0Cs= Received: (qmail 115396 invoked by alias); 23 Oct 2017 17:05:26 -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 115361 invoked by uid 89); 23 Oct 2017 17:05:25 -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=013 X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:05:24 +0000 Received: by mail-wm0-f53.google.com with SMTP id q124so10886885wmb.0 for ; Mon, 23 Oct 2017 10:05:23 -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=lLF5LRJkN3yoSAimfTCGo2q3iL+Gh3gyKKFYuYMH1zE=; b=KVQELI2x7iG4QissQBAE/p+J707gtfw9XhNb7jG/VIjp/uHtQ+0ukhn5/Q1ZrSL/kL SrtGWCxbLfsSCOFew2OEX2vdFsCAftYaxINyW54/cXCu5B2TjrU2SbtRPQZZeS+vc/xC AkOuis9HJIl7QBzG3YW94PmXvBEfGL3LpQ30bsSWife9uYiKc/P8m1n3zA+sBklNEXZn Diqkx5uNnEye83An6AHZJ6pIugkeDhRyEuzgoQE3hhO9q4CPPbuEDQBQvaaLscnzN1t1 s8DQ5B7S4lr+1jPh5ToGgOEa8TcxIGxR743PLWm8rkAwSm9ikfzd9xMYbCAnCebipdAN Mo9g== X-Gm-Message-State: AMCzsaW5wKEjkCYTeSQom+jS1YbvXMi+1WbR3EtCM/Gjxd8uNua9k2YB fdn/Qr3s9QqGExcns6m/mII53007+SY= X-Google-Smtp-Source: ABhQp+RYDjMRKj+0i+W2EUk8njjxTdGRiyUDk8F0mo3Hrh4EHlnFCcMZjD12zAG91PNiwsoJ4yWxfA== X-Received: by 10.28.47.69 with SMTP id v66mr6353768wmv.98.1508778321852; Mon, 23 Oct 2017 10:05:21 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id 56sm6123138wrx.2.2017.10.23.10.05.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:05:20 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [013/nnn] poly_int: same_addr_size_stores_p References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:05:20 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87bmkxsskv.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes tree-ssa-alias.c:same_addr_size_stores_p handle poly_int sizes and offsets. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-ssa-alias.c (same_addr_size_stores_p): Take the offsets and sizes as poly_int64s rather than HOST_WIDE_INTs. Index: gcc/tree-ssa-alias.c =================================================================== --- gcc/tree-ssa-alias.c 2017-10-23 16:52:20.150440950 +0100 +++ gcc/tree-ssa-alias.c 2017-10-23 17:01:49.579064221 +0100 @@ -2322,14 +2322,14 @@ stmt_may_clobber_ref_p (gimple *stmt, tr address. */ static bool -same_addr_size_stores_p (tree base1, HOST_WIDE_INT offset1, HOST_WIDE_INT size1, - HOST_WIDE_INT max_size1, - tree base2, HOST_WIDE_INT offset2, HOST_WIDE_INT size2, - HOST_WIDE_INT max_size2) +same_addr_size_stores_p (tree base1, poly_int64 offset1, poly_int64 size1, + poly_int64 max_size1, + tree base2, poly_int64 offset2, poly_int64 size2, + poly_int64 max_size2) { /* Offsets need to be 0. */ - if (offset1 != 0 - || offset2 != 0) + if (maybe_nonzero (offset1) + || maybe_nonzero (offset2)) return false; bool base1_obj_p = SSA_VAR_P (base1); @@ -2348,17 +2348,19 @@ same_addr_size_stores_p (tree base1, HOS tree memref = base1_memref_p ? base1 : base2; /* Sizes need to be valid. */ - if (max_size1 == -1 || max_size2 == -1 - || size1 == -1 || size2 == -1) + if (!known_size_p (max_size1) + || !known_size_p (max_size2) + || !known_size_p (size1) + || !known_size_p (size2)) return false; /* Max_size needs to match size. */ - if (max_size1 != size1 - || max_size2 != size2) + if (may_ne (max_size1, size1) + || may_ne (max_size2, size2)) return false; /* Sizes need to match. */ - if (size1 != size2) + if (may_ne (size1, size2)) return false; @@ -2386,10 +2388,9 @@ same_addr_size_stores_p (tree base1, HOS /* Check that the object size is the same as the store size. That ensures us that ptr points to the start of obj. */ - if (!tree_fits_shwi_p (DECL_SIZE (obj))) - return false; - HOST_WIDE_INT obj_size = tree_to_shwi (DECL_SIZE (obj)); - return obj_size == size1; + return (DECL_SIZE (obj) + && poly_int_tree_p (DECL_SIZE (obj)) + && must_eq (wi::to_poly_offset (DECL_SIZE (obj)), size1)); } /* If STMT kills the memory reference REF return true, otherwise