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