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