From patchwork Mon Oct 23 17:11:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116772 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4877510qgn; Mon, 23 Oct 2017 10:11:49 -0700 (PDT) X-Received: by 10.99.7.208 with SMTP id 199mr12031273pgh.158.1508778708969; Mon, 23 Oct 2017 10:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778708; cv=none; d=google.com; s=arc-20160816; b=dFXHvW2C4r1SwAgsz0mPhyyuPBLsqxCvS26NEycmaGWDeDCRsJxs+zIBE8lxv5qXrR kwfH09ypgkmRZm4PgvfJn53HxfOosUcUsGjL/WiyJsCVCpJDQeMLm61vlYRktxc19qcx Eqi2Hb0A7WH42Fp9zvOAa0X0vvGBXV+xgspkckWZuQVAfvj0+tO2lLSKNvGX42Dk386/ 9VW1cLCrs77fXR4UUN/KfRwW4OlQ2aUtPr3gRPGq+vvFCokvvs9VnL82vQhZJcer8FVu 7UvUU8tliK03PSWpsAOC884m7zVbWMGolQSv60f/Spw9hwfJD9S33X8wpGOCC9Kd5Vb6 XhnA== 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=5ZR+FQ4gG/oUVe6H86G3wSnw8r9NPP7p9P+LCV008eI=; b=Ib67Hb2VFpIKvl4xQEiRJ9FEbKgBTip+U6ejwtIwVjJtBR0NJnaNvwBBVWMABpPUNV md8P0dz24LP+lMhDzXSg2oGAM1rEhC9ET2okD9OPkJgA7lcq4QfIsKs/s6YFiOppwY7a P4wqJb0059cAMGW3HsIfomZaV2HZql2DIC3TCMSEayyL7vajOZtjwJXvsbhxu1cJ0qj0 KBKwgi4agJoJiqAcVOAGWBGPrdQjsgjKeeEufUnz3qaIA83Br40qptAECaI+G2R/YAYt Gc09+guhRSOXYFHl2cfWI4RshNd96ro+wC2faGibS+lALuExzr7dJHmG5KedrywaXL7y QyaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oRM83G2p; spf=pass (google.com: domain of gcc-patches-return-464804-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464804-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 n7si5117636pgp.62.2017.10.23.10.11.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:11:48 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464804-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=oRM83G2p; spf=pass (google.com: domain of gcc-patches-return-464804-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464804-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=k8zKR3S5jorOrVWuCZvfWkJkblIf5 dmlmmVBHy/g3JQuHjY92A4uWwvppRA2Zbrgh34fMyyw1aEvHxeaiq3eJE4lN7G0D KiObdAzzU5iCpQfv+NKe0N3DUimTZ+lef8/QBCT+V5I1YGX/tYNmdvZAST+vs5Ew hR8xzWC/MXol7E= 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=FhgBXydEGQ7YQeF5+CU+EpWdys4=; b=oRM 83G2pTkxrTpnMvj4DwdAYN/zsWItQEHKLu0POfeGXtM4lhQ/N8AP5BsOn3VjdYx1 reLqpNgRPti/6qQwI0I5rMrzHtj6miP2tm1uL4lzWdNYkDnr6mUwEF6HhJ7KwJpX eaFLkL0igmqvqf0lDvqN1Wq89NEBMQN3lVlHz2+o= Received: (qmail 13714 invoked by alias); 23 Oct 2017 17:11:34 -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 13573 invoked by uid 89); 23 Oct 2017 17:11:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=028, adjustments X-HELO: mail-wr0-f181.google.com Received: from mail-wr0-f181.google.com (HELO mail-wr0-f181.google.com) (209.85.128.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:11:31 +0000 Received: by mail-wr0-f181.google.com with SMTP id l8so5266319wre.12 for ; Mon, 23 Oct 2017 10:11:31 -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=5ZR+FQ4gG/oUVe6H86G3wSnw8r9NPP7p9P+LCV008eI=; b=d0PnEy+B810aJSEFrTIm3OFmiayBbgVdCcqh4YeTQ7Vs/ajO7MIytaqzz0NXjBIPnq 9SI0SpwGh4Lbbvtk5ECl67J33s2xqlerns0HWoHSABBER6S0iFL4LLeczJ6aywv1oLp/ XH9CgM8gXe8Q37l/Wcgx/r91uEujgzh+Sabt0AF6XJRPLE2alri7hBOV23UxEbHSzNM/ y688aHqooBd5lzifbr82b2BfI+kt/ouFlvhSaARyuR9uD8l3RYPUSNZHi+XhBZ1gQ5nk lOyhFmZ81UINo0RAXas1Td+qfjk3hl/zeR//vD/RuEXMOFcP/jmL782++zgQySWjUqtI Ncww== X-Gm-Message-State: AMCzsaXSHw3wRLUNhzPBCxgec+ESaiIiatkEyKPmgGPu8ctPOBUkJEiH Z5zy9k14ETh91QwU/jYPzr6H89bGQUU= X-Google-Smtp-Source: ABhQp+ST6VwSKr8DcPm0/n/JbsXgidMnIMjXh0SmUSXNwbHHBiim2ez56tzN/VUQ0snoWSdy1fLQTg== X-Received: by 10.223.139.18 with SMTP id n18mr11123707wra.223.1508778689685; Mon, 23 Oct 2017 10:11:29 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id t18sm293254wrg.49.2017.10.23.10.11.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:11:29 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [028/nnn] poly_int: ipa_parm_adjustment References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:11:28 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87inf5pz5r.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch changes the type of ipa_parm_adjustment::offset from HOST_WIDE_INT to poly_int64 and updates uses accordingly. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * ipa-prop.h (ipa_parm_adjustment::offset): Change from HOST_WIDE_INT to poly_int64_pod. * ipa-prop.c (ipa_modify_call_arguments): Track polynomail parameter offsets. Index: gcc/ipa-prop.h =================================================================== --- gcc/ipa-prop.h 2017-10-23 17:07:40.959671257 +0100 +++ gcc/ipa-prop.h 2017-10-23 17:16:58.508429306 +0100 @@ -828,7 +828,7 @@ struct ipa_parm_adjustment /* Offset into the original parameter (for the cases when the new parameter is a component of an original one). */ - HOST_WIDE_INT offset; + poly_int64_pod offset; /* Zero based index of the original parameter this one is based on. */ int base_index; Index: gcc/ipa-prop.c =================================================================== --- gcc/ipa-prop.c 2017-10-23 17:07:40.959671257 +0100 +++ gcc/ipa-prop.c 2017-10-23 17:16:58.507429441 +0100 @@ -4302,15 +4302,14 @@ ipa_modify_call_arguments (struct cgraph simply taking the address of a reference inside the original aggregate. */ - gcc_checking_assert (adj->offset % BITS_PER_UNIT == 0); + poly_int64 byte_offset = exact_div (adj->offset, BITS_PER_UNIT); base = gimple_call_arg (stmt, adj->base_index); loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base) : EXPR_LOCATION (base); if (TREE_CODE (base) != ADDR_EXPR && POINTER_TYPE_P (TREE_TYPE (base))) - off = build_int_cst (adj->alias_ptr_type, - adj->offset / BITS_PER_UNIT); + off = build_int_cst (adj->alias_ptr_type, byte_offset); else { HOST_WIDE_INT base_offset; @@ -4330,8 +4329,7 @@ ipa_modify_call_arguments (struct cgraph if (!base) { base = build_fold_addr_expr (prev_base); - off = build_int_cst (adj->alias_ptr_type, - adj->offset / BITS_PER_UNIT); + off = build_int_cst (adj->alias_ptr_type, byte_offset); } else if (TREE_CODE (base) == MEM_REF) { @@ -4341,8 +4339,7 @@ ipa_modify_call_arguments (struct cgraph deref_align = TYPE_ALIGN (TREE_TYPE (base)); } off = build_int_cst (adj->alias_ptr_type, - base_offset - + adj->offset / BITS_PER_UNIT); + base_offset + byte_offset); off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off); base = TREE_OPERAND (base, 0); @@ -4350,8 +4347,7 @@ ipa_modify_call_arguments (struct cgraph else { off = build_int_cst (adj->alias_ptr_type, - base_offset - + adj->offset / BITS_PER_UNIT); + base_offset + byte_offset); base = build_fold_addr_expr (base); } } @@ -4602,7 +4598,7 @@ ipa_get_adjustment_candidate (tree **exp struct ipa_parm_adjustment *adj = &adjustments[i]; if (adj->base == base - && (adj->offset == offset || adj->op == IPA_PARM_OP_REMOVE)) + && (must_eq (adj->offset, offset) || adj->op == IPA_PARM_OP_REMOVE)) { cand = adj; break; @@ -4766,7 +4762,10 @@ ipa_dump_param_adjustments (FILE *file, else if (adj->op == IPA_PARM_OP_REMOVE) fprintf (file, ", remove_param"); else - fprintf (file, ", offset %li", (long) adj->offset); + { + fprintf (file, ", offset "); + print_dec (adj->offset, file); + } if (adj->by_ref) fprintf (file, ", by_ref"); print_node_brief (file, ", type: ", adj->type, 0);