From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 17:13:00 -0000 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 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01533.txt.bz2 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. */