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: 116776 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4878985qgn; Mon, 23 Oct 2017 10:13:17 -0700 (PDT) X-Received: by 10.99.64.5 with SMTP id n5mr12188665pga.244.1508778797495; Mon, 23 Oct 2017 10:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778797; cv=none; d=google.com; s=arc-20160816; b=Ks73ZeBrXdjB9oaXzyEni06N5dfDo77U0GyWcX3iFtptxchbviE5IH5If2eAo86lmz ExqYc4uVou/iGBaZzMIYf4Tj3S/AviCz+eApYKQQRbP0ctJN/9MmZ+pmDUXqPeQ710v1 DmrvEF3NHAXISUQUt99yzXeKoL/feYpJfAygra+jayzCTNSkEQGWrHnRMLOAmX1kzVKF T4n1dtHBO1ytslWVLLWz3RxHh/VQjNdStvrhLQ2jjxELuWBxsdgzFZXE6UQ044BY8ZiN mk+wIpG0F4Pd2qTk4pymjjqGbfMs8BIfK0vDMAxGXNtaRBS46wqc82ZNvejadyIPvD/J MsOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=psCyAoi/e3pmGx9p/wVNzz/ZZes3AZiwlp6fvPEsG6s=; b=OCf8VdfxqGN/6tyoOsZtGTNgZ/Xm3O/xBK9mfsXe1BHhggEaBqCVliSemgNY46ogV3 UBn1L4QanDtKfI/8krmi/5puCYZYKFm77cPkTMlfJ41PQM8wrPUmmy12KPHtNMTp7Fnd W/fp8gRlsPA14yzxVYovaEe4tAOEx2X1fOxAsBDxbKjOaGhFIaClPzM3sI9WBGJnU1iF A3m5tc7f/BAPcKktinnt0RLjPIoo94D8nYbINNcbT0LKJWKj1PXTicB23BKY4MVryCyC sA74T+JkKI92uhtIDM4D5dD2E0d69gC6k1I38BgH1nDD1O6PxfVMjmOup+AyIKUqL9bZ QrNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ZXEGVJoX; spf=pass (google.com: domain of gcc-patches-return-464808-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464808-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m5si5141592pgs.223.2017.10.23.10.13.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:13:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464808-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ZXEGVJoX; spf=pass (google.com: domain of gcc-patches-return-464808-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464808-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=UQlsUq7AxLCKUGf/OZfE7eNQZDf+h iYTX7d+lihqjsbgS15/lnl8dy8roMYQNBcDszOM+3LunrEsOfQNep5YS4C9NLhOu PH52uNIccigoTYO4QJ0j2KjbsG+dQLmZhXJyQ2yBC1a1jMc7QwAesqCQKCwr2XEV Fqb3eQw5GPDu2E= 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=ZXE GVJoXtBXCrkVADR+1QKuBM/KjiQHfNvwG0+P3p07m8mZKxp5SulA2DEcgUqveRW2 6Jx4TRT3qU5p6kHHWnutptXT6IsySH05dQ0QXberJNpiJbT5TO+uPAmaqXARi3rY jACQn03r0RFUFhNfYEkkuQdyWaoMdsp8u+cwiM5I= 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. */