From patchwork Mon Oct 23 17:04:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116756 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4870814qgn; Mon, 23 Oct 2017 10:05:26 -0700 (PDT) X-Received: by 10.84.236.12 with SMTP id q12mr10818733plk.204.1508778326204; Mon, 23 Oct 2017 10:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778326; cv=none; d=google.com; s=arc-20160816; b=kjS/P5ZfiT6bDpN90RweThpC3XNYvxHB694ap7aQZLBF3Ul1RgVXg+QfKEkhLMUcme 6FhjgS4nG+hFixKl9kQ0Y/uhq4bvWpkwnxw0yVbaZWh62AtcpXzQN9CfPlJo8mfG57Mv TEskUGtEdGdS32+ISQD1u2kv+ScpWDkUfI93Io3iPhmhZf5EfsT9hL53XNqUyLuaaTxe jb8DgjNMQ55AlyGLT4sTNccocY14zhN1vDyOA7swfWytf8IgTUlU/T3BLpmI+DAjfV3q 0tbsluqsOAxlmF0IPfyBLBy1gnN1fhlyts1qx1ysgNpCxxpQOYKu9JUi0RWfme4dOJV8 BRFA== 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=1w43RUA1NEfoKFslJeJAnk9xSemWZl8cPw1MIPr9r1A=; b=jqq1yvcjhecs/+kBtCBosZRBrXEUGE/CquvEa4WloHqHVDj6cP5RV1k37ibk0y/AUo JDs7yc7zjhO0U76R/L4xq8e51kOfDDMYKyFPafDOw5JYoxdeMS9mwV7vS2tJnjgL5gyc MLf9azHN5n9YVbNLLRkpTdCn/fjAcZ0o2FgD1/HCDjztW01FQlIrI/ngCxUEARCfBNfu P/h7R36mV1I4JOfw1fSgyivRNVaPAjoq20WR+Zskon++UIP1PF/73dfEx5sLVgwTN7Sb Fa4xGMwOkxOnzcFbE38hm8QVWjvgntzxHfbGOZD4pQWuYLkVN4+iBwXdngNx2dRyVkbc 0Khw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ycAqHKaJ; spf=pass (google.com: domain of gcc-patches-return-464788-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464788-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 z15si5114797pgs.442.2017.10.23.10.05.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:05:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464788-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=ycAqHKaJ; spf=pass (google.com: domain of gcc-patches-return-464788-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464788-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=UAcfAAib8khyeaD3pwFLVMbmpdiMI SEbJej+J2Hci2BYHBsq7SizQUL8J+5gQHK1wV/ctM4sLHI052YOdHwmr3Nxoy/BV xIpvYhzFhu1qo/NsltvSU33EcuIDVvMorB6C+fVCppz5rVoFx6k8b44dPf5231Bs kkEgpBDulGfHAs= 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=vjtTbXIzFaaSPPz2W591/8CAMLE=; b=ycA qHKaJKM0CEarsCsgs0WFGMdi73C1ETfBD46FMDVlWxhXX8TFAx+6/23c5dUWVDQO epCK0wteWcrQF/s/sqJrgjsEd5c0CoRnLPxRthPP/k/oAbcN+klj453c3rT/yn/c 6bGIhwvfYJDMCQMpPzawSqMgvqllBE/Ty4s8glCs= Received: (qmail 113565 invoked by alias); 23 Oct 2017 17:05:00 -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 113534 invoked by uid 89); 23 Oct 2017 17:05:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:04:58 +0000 Received: by mail-wr0-f175.google.com with SMTP id p96so4236345wrb.7 for ; Mon, 23 Oct 2017 10:04:58 -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=1w43RUA1NEfoKFslJeJAnk9xSemWZl8cPw1MIPr9r1A=; b=izX4/7hzUWEXiXT+Xouo9EQaeq6bgiV5i3FrO0khf+u13MplDlH9UrOzurDHKbQU09 CT7e++++rn+7emvPyVdToujVup2JW2qGYRPXrKhp557SIm9tI8K8noUYijmYJTfFT8/M TWPwXlTkQVwPgsMrIgWSW/2cUXyyxfziF39YfdaH9K/UZvcFCH1gzobKlcHdh780k+qR fQy37QjVzSMMUnSDIRB93/hJLBMAUGsuY+XEEi+afExMhzLWr6+hwOcUiIXHJFXAJmTs 5gToyoLjpxzGlDHab0LplFbXxUk8nj9zYx1RBrOn//8XSsZXPyQ8QLg89mETHSIl141c nA5g== X-Gm-Message-State: AMCzsaWZ+5T8VtSbyPoVAjHuF4+7QtHmKVq1nZkLeZyR2UsL7vJ+LRwn oX1X64BO6qHGunI+YJT1eRuaL6F1kXs= X-Google-Smtp-Source: ABhQp+S1Z0pX6kR0xdvV4mdOPSpcEpLgFo5hqYbXAIIAIbbiGU1C7idKHmW05MXpnxbWOrY/iyYFHg== X-Received: by 10.223.151.51 with SMTP id r48mr12021721wrb.164.1508778296534; Mon, 23 Oct 2017 10:04:56 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id r3sm11774303wmb.5.2017.10.23.10.04.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:04:55 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [012/nnn] poly_int: fold_ctor_reference References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:04:54 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87fua9ssll.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch changes the offset and size arguments to fold_ctor_reference from unsigned HOST_WIDE_INT to poly_uint64. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * gimple-fold.h (fold_ctor_reference): Take the offset and size as poly_uint64 rather than unsigned HOST_WIDE_INT. * gimple-fold.c (fold_ctor_reference): Likewise. Index: gcc/gimple-fold.h =================================================================== --- gcc/gimple-fold.h 2017-10-23 16:52:20.201487839 +0100 +++ gcc/gimple-fold.h 2017-10-23 17:01:48.165079780 +0100 @@ -44,8 +44,7 @@ extern tree follow_single_use_edges (tre extern tree gimple_fold_stmt_to_constant_1 (gimple *, tree (*) (tree), tree (*) (tree) = no_follow_ssa_edges); extern tree gimple_fold_stmt_to_constant (gimple *, tree (*) (tree)); -extern tree fold_ctor_reference (tree, tree, unsigned HOST_WIDE_INT, - unsigned HOST_WIDE_INT, tree); +extern tree fold_ctor_reference (tree, tree, poly_uint64, poly_uint64, tree); extern tree fold_const_aggregate_ref_1 (tree, tree (*) (tree)); extern tree fold_const_aggregate_ref (tree); extern tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree, Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c 2017-10-23 16:52:20.201487839 +0100 +++ gcc/gimple-fold.c 2017-10-23 17:01:48.164081204 +0100 @@ -6365,20 +6365,25 @@ fold_nonarray_ctor_reference (tree type, return build_zero_cst (type); } -/* CTOR is value initializing memory, fold reference of type TYPE and size SIZE - to the memory at bit OFFSET. */ +/* CTOR is value initializing memory, fold reference of type TYPE and + size POLY_SIZE to the memory at bit POLY_OFFSET. */ tree -fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, - unsigned HOST_WIDE_INT size, tree from_decl) +fold_ctor_reference (tree type, tree ctor, poly_uint64 poly_offset, + poly_uint64 poly_size, tree from_decl) { tree ret; /* We found the field with exact match. */ if (useless_type_conversion_p (type, TREE_TYPE (ctor)) - && !offset) + && known_zero (poly_offset)) return canonicalize_constructor_val (unshare_expr (ctor), from_decl); + /* The remaining optimizations need a constant size and offset. */ + unsigned HOST_WIDE_INT size, offset; + if (!poly_size.is_constant (&size) || !poly_offset.is_constant (&offset)) + return NULL_TREE; + /* We are at the end of walk, see if we can view convert the result. */ if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset