From patchwork Mon Oct 23 17:12:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829455 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-464808-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="L88LNLq5"; 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 3yLNJm0lthz9t6C for ; Tue, 24 Oct 2017 04:13:11 +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=OE/Bt2kuJXMC3EFqpFOTwmEbgpAlh PkjL3dlDOrPXUmHcdWVfj/1pQyr0M/UVbDaoDTdhkDXEz/D57/60LQ6d0R1eNoxW XsDLlmGT+ykjZh2KyQAKiveqxiyDfFN0te9sqovyB1FUqJoficxxBzB7uXoVifUm FILblpcK7cO2LA= 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=CBCkpfXI82MvZloojmrUk5rpK38=; b=L88 LNLq59Qt8cK9fg2Dzr82yLH4Loc6PYSgRW8qLljHc8nIIfX8JGjrSTbSR8nTSPpR TcX0CdzyQFiGdlFTBToukGrP45f6cmu7zRRkUO5Yazj1Ys2k1RgGAlLBQUvDwTQx xgYM8d1OMjd6MA4unN7cW1vJsr1CEO6l5k93GGz8= Received: (qmail 21861 invoked by alias); 23 Oct 2017 17:13:02 -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 21851 invoked by uid 89); 23 Oct 2017 17:13:02 -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= X-HELO: mail-wm0-f54.google.com Received: from mail-wm0-f54.google.com (HELO mail-wm0-f54.google.com) (74.125.82.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:13:01 +0000 Received: by mail-wm0-f54.google.com with SMTP id b189so10837437wmd.4 for ; Mon, 23 Oct 2017 10:13:00 -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=psCyAoi/e3pmGx9p/wVNzz/ZZes3AZiwlp6fvPEsG6s=; b=h6CBX+oVf0Ryv8DbRYKjn2U23YfGkUnPr5R+LFoAUXtuZUvlFnbri79ZRK8ljsTgKy DDpo1pCrLs+FpJMfzO+HtqvUiA9CYtdzjMexKGjg/qSZ8vqDNfXEMSTol6Kk09it3gpg JOrYp5PJKiDOmthCIRubi9xDaTKhFiBmuzXzKHxmMWwA8Cf2jIyNGW1b37LN+8I2nn6c qz08gVWfCGivT63J7RU0kIdaK//8UjTv/kyw5MjuwENskQS2LRbGyl3ZvRdN+nsj9ytG JvzNwgh4GwfKlq6/xE7j06AKFOjp9Tpke+co8Zm2ZYVQLncaFmjMdPrmRdq2CFgoGTlr g56Q== X-Gm-Message-State: AMCzsaWtGmTKVMV3Su3jpKQ5wdyGye+vozxyb/cyp+QQOHBPgkemguVS wSUSj1K+7X0f+QeroBQPPcTIcyXHs+s= X-Google-Smtp-Source: ABhQp+TY3yUE8PifYAniMdSV0mvdq5kWTFZ9bjhQIqye0ztXorO+gVrcwuHX6pN8PuV0Wr3ikzl1Ig== X-Received: by 10.28.126.196 with SMTP id z187mr5992355wmc.69.1508778779074; Mon, 23 Oct 2017 10:12:59 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id s196sm4181169wmb.6.2017.10.23.10.12.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:12:58 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [032/nnn] poly_int: symbolic_number References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:12:57 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <871sltpz3a.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch changes symbol_number::bytepos from a HOST_WIDE_INT to a poly_int64. perform_symbolic_merge can cope with symbolic offsets as long as the difference between the two offsets is constant. (This could happen for a constant-sized field that occurs at a variable offset, for example.) 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-ssa-math-opts.c (symbolic_number::bytepos): Change from HOST_WIDE_INT to poly_int64. (perform_symbolic_merge): Update accordingly. Index: gcc/tree-ssa-math-opts.c =================================================================== --- gcc/tree-ssa-math-opts.c 2017-10-23 17:11:39.997472274 +0100 +++ gcc/tree-ssa-math-opts.c 2017-10-23 17:17:04.541614564 +0100 @@ -1967,7 +1967,7 @@ struct symbolic_number { tree type; tree base_addr; tree offset; - HOST_WIDE_INT bytepos; + poly_int64 bytepos; tree src; tree alias_set; tree vuse; @@ -2198,7 +2198,7 @@ perform_symbolic_merge (gimple *source_s if (rhs1 != rhs2) { uint64_t inc; - HOST_WIDE_INT start_sub, end_sub, end1, end2, end; + HOST_WIDE_INT start1, start2, start_sub, end_sub, end1, end2, end; struct symbolic_number *toinc_n_ptr, *n_end; basic_block bb1, bb2; @@ -2210,15 +2210,19 @@ perform_symbolic_merge (gimple *source_s || (n1->offset && !operand_equal_p (n1->offset, n2->offset, 0))) return NULL; - if (n1->bytepos < n2->bytepos) + start1 = 0; + if (!(n2->bytepos - n1->bytepos).is_constant (&start2)) + return NULL; + + if (start1 < start2) { n_start = n1; - start_sub = n2->bytepos - n1->bytepos; + start_sub = start2 - start1; } else { n_start = n2; - start_sub = n1->bytepos - n2->bytepos; + start_sub = start1 - start2; } bb1 = gimple_bb (source_stmt1); @@ -2230,8 +2234,8 @@ perform_symbolic_merge (gimple *source_s /* Find the highest address at which a load is performed and compute related info. */ - end1 = n1->bytepos + (n1->range - 1); - end2 = n2->bytepos + (n2->range - 1); + end1 = start1 + (n1->range - 1); + end2 = start2 + (n2->range - 1); if (end1 < end2) { end = end2; @@ -2250,7 +2254,7 @@ perform_symbolic_merge (gimple *source_s else toinc_n_ptr = (n_start == n1) ? n2 : n1; - n->range = end - n_start->bytepos + 1; + n->range = end - MIN (start1, start2) + 1; /* Check that the range of memory covered can be represented by a symbolic number. */