From patchwork Mon Oct 23 17:23:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116802 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4889064qgn; Mon, 23 Oct 2017 10:24:31 -0700 (PDT) X-Received: by 10.98.102.74 with SMTP id a71mr13509271pfc.23.1508779471385; Mon, 23 Oct 2017 10:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779471; cv=none; d=google.com; s=arc-20160816; b=fXuupsHSyWpov6AkOD0m4j/UTd/JKl/Zj7xwpYDBLUrU/c45HLhsLTa8bIvu8ozU+I cxr1WflXwjKCqcGV3Z11GhhcqSLfgyCAh3NoiTIS6Qmrcvm2dTWyu9eAHOelK02YDqm4 +yfcE18/Pmk/bAUdq4c1KUOAdEw6tw3I+a2v1gVy/w73MOoiH0xaWZCUJvhN6b36SVOV fIOkiAPgRg1OwJTjMMiPgbB6+76giRWQ6F+433DE87+fw2ZzV64+sJmylEr9x+mPLR6F OtbKyda9dBcLMMLK+KWiC9NsVAztI04gXZNOSwUORajOYWvFfqyMfXXt+fQS21DDBfCL Y4XA== 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=lP9k7yYYH+YIXeIO5fVMUWX0e25ASG6oyeztXmCEKr0=; b=FDqcehVVZVulb4U0TE/t4olDal2kHq1IYvfAVYRiuuNcTGrD+oshaGwGq6fwvmTScd g1CYYaWh5ceizpdD9if78pywVEtphrNCBjAGIzTpiNWjPVuRd45qtOCu49g1uslm96eA WAB0nQU0VqrRivavqLFarzmEbBG8w0VYHId4OS31c65L0hectwj4P2KMDB8B1NyCcOkL bQ+l5f59K0mglaVzl2B0zxjFaFuomEcLclIshfad+VzZ9Dq3fg0Ybm5g67ALUkcOMWPZ I0U4zbF4DZNSLmU3I+cxu9TDZfuy4aO+cC3UcuJwkDH29+8qQVGiRQz8zscpklerwG0a C37w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=G1v1tJZe; spf=pass (google.com: domain of gcc-patches-return-464833-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464833-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 t191si5153843pgc.187.2017.10.23.10.24.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464833-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=G1v1tJZe; spf=pass (google.com: domain of gcc-patches-return-464833-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464833-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=GTY3xSjgdUDmibGj01d4qqSzLa6F+ /NixPNgKk0bgvNnDCZ6IAjepANERJGwxSiCzX0Cdq8kt9IjFa7DaP8G2HwWOSwv4 HYCOzj4O3BZsrsQYFCuI2cDlK47eJGyCZHpQnjZaOE6sEjAs0aTcMcJZccko/FRK AbVn8e12NrGaHo= 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=CRmJSGWwx5diXA9u2+ezX2egUw8=; b=G1v 1tJZe9R3dkk8j+A+2cKyHnGh+hLE0S7XZMH5lHnXaeWwFKKYq5AYda5Dtn9qlUKw ovxeur3MIy8CZjNu8Uunta2xXyfvPiBVHC4x4MMo5CtSCLBFuY9a1ZaGOnekztku VycenrGSKhy3bGkmOVfpTYHxjRxx0Bw0aOjLwWbk= Received: (qmail 56082 invoked by alias); 23 Oct 2017 17:24:05 -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 55923 invoked by uid 89); 23 Oct 2017 17:24:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=057 X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:24:02 +0000 Received: by mail-wm0-f45.google.com with SMTP id p75so10955764wmg.3 for ; Mon, 23 Oct 2017 10:24:01 -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=lP9k7yYYH+YIXeIO5fVMUWX0e25ASG6oyeztXmCEKr0=; b=cqpJ+kTpOtTQKugEEKEE6ITWO0ySIq8CZEDNGten7IYehUuVaom5gfzxY/qmj5cBwA 7QxZZOdG022fyMfItx51GPeGY4kZBjFJJY7Cbf04WSCEJXr23lKC5lJRMPVvTfbomxq3 WNQYpdnIKglBBoCBgcv68Yn062v/EnQHeg2USeRUERhu8msQTp2neH7LLajZqPq/0uA8 HCF3eoi1WGFHKH1TlbARCXNEwCY/M8jkGHGIUp9OWmm53U4snDU9+TX9qacYHEfT4O51 ZxIyh3F6iZkSq//vBu4WW73v7/sJ1HoUmv1GDCMSMd5P/iy3+dRXXXFkGNGbhY6Glgs2 R8JA== X-Gm-Message-State: AMCzsaUVsY/I3dfrMy19LTYd6UMOqg88kwuHYqIk3ZG4RiD9Zhni2Iep pN6g804aF58iKnwLAyJLsjF+aHurlB8= X-Google-Smtp-Source: ABhQp+Ry3TLDyI7Bm4I5sWqLry+sNAB41+iFVNqGIdXGPJs8hnUawHyXymoGrX2Xr8jxfavz5bgVJg== X-Received: by 10.28.156.23 with SMTP id f23mr6487201wme.128.1508779439708; Mon, 23 Oct 2017 10:23:59 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id c37sm8017522wrc.92.2017.10.23.10.23.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:23: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: [057/nnn] poly_int: build_ref_for_offset References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:23:58 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <871sltlqvl.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 parameter to build_ref_for_offset from HOST_WIDE_INT to poly_int64. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * ipa-prop.h (build_ref_for_offset): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. * tree-sra.c (build_ref_for_offset): Likewise. Index: gcc/ipa-prop.h =================================================================== --- gcc/ipa-prop.h 2017-10-23 17:16:58.508429306 +0100 +++ gcc/ipa-prop.h 2017-10-23 17:22:20.152210973 +0100 @@ -878,7 +878,7 @@ void ipa_release_body_info (struct ipa_f tree ipa_get_callee_param_type (struct cgraph_edge *e, int i); /* From tree-sra.c: */ -tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree, +tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree, gimple_stmt_iterator *, bool); /* In ipa-cp.c */ Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c 2017-10-23 17:18:47.667056920 +0100 +++ gcc/tree-sra.c 2017-10-23 17:22:20.153211173 +0100 @@ -1671,7 +1671,7 @@ make_fancy_name (tree expr) of handling bitfields. */ tree -build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, +build_ref_for_offset (location_t loc, tree base, poly_int64 offset, bool reverse, tree exp_type, gimple_stmt_iterator *gsi, bool insert_after) { @@ -1689,7 +1689,7 @@ build_ref_for_offset (location_t loc, tr TYPE_QUALS (exp_type) | ENCODE_QUAL_ADDR_SPACE (as)); - gcc_checking_assert (offset % BITS_PER_UNIT == 0); + poly_int64 byte_offset = exact_div (offset, BITS_PER_UNIT); get_object_alignment_1 (base, &align, &misalign); base = get_addr_base_and_unit_offset (base, &base_offset); @@ -1711,27 +1711,26 @@ build_ref_for_offset (location_t loc, tr else gsi_insert_before (gsi, stmt, GSI_SAME_STMT); - off = build_int_cst (reference_alias_ptr_type (prev_base), - offset / BITS_PER_UNIT); + off = build_int_cst (reference_alias_ptr_type (prev_base), byte_offset); base = tmp; } else if (TREE_CODE (base) == MEM_REF) { off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)), - base_offset + offset / BITS_PER_UNIT); + base_offset + byte_offset); off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off); base = unshare_expr (TREE_OPERAND (base, 0)); } else { off = build_int_cst (reference_alias_ptr_type (prev_base), - base_offset + offset / BITS_PER_UNIT); + base_offset + byte_offset); base = build_fold_addr_expr (unshare_expr (base)); } - misalign = (misalign + offset) & (align - 1); - if (misalign != 0) - align = least_bit_hwi (misalign); + unsigned int align_bound = known_alignment (misalign + offset); + if (align_bound != 0) + align = MIN (align, align_bound); if (align != TYPE_ALIGN (exp_type)) exp_type = build_aligned_type (exp_type, align);