From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51780 invoked by alias); 23 Oct 2017 17:17:12 -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 51573 invoked by uid 89); 23 Oct 2017 17:17:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f42.google.com Received: from mail-wm0-f42.google.com (HELO mail-wm0-f42.google.com) (74.125.82.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:17:11 +0000 Received: by mail-wm0-f42.google.com with SMTP id m72so10945433wmc.1 for ; Mon, 23 Oct 2017 10:17:10 -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=J13Bo0CcFh501EaVMk7HQ6czPr999V4ob4O1DWya3nE=; b=mtJZ1fU4tlB+nl2Bdu5MFU5QSio4KZdkUgT22esJWzQ+HCYmaSY0SgAaujp56M1w/5 4DXhd+3Ex5N8UnPmVh14Ip6gdl1fN1X1sAgifMUau8PALPXTPEVyLTq7RCb4LtEhcSPg 3c7EpHd5rt8Bg8i9CzKLLFOdQfrVqBdcOvFcrUI74XniARG7yNu/nRXxmH4XFaudr9qF BGNzz39ioBHQV0Xb5vyBMj7ydHyZlDSRik+dP9FnJ4t0ZCtwWmgAgBfspn9UzoHA6Xo7 IvnhKPMvZErvzejF2NyXm+iP1QQv+TGCvnthICVjBNCJmDM9m/hMln7PIazvMkpE4PCj fZgw== X-Gm-Message-State: AMCzsaXRfQ/7EJlluQqUD+KsfWPrdFlfHSDXxAnBayWnDFpYPErHB9SA WyqB9wE6s5M/318svfXX9SxgXq674To= X-Google-Smtp-Source: ABhQp+TR2ray0A+Yy2fhB8jCRzWFE4N6wO7Be3BizSfQ/pPl+97zQPFGIT90JBh27efNyIlwzg3T3Q== X-Received: by 10.28.143.203 with SMTP id r194mr6412503wmd.39.1508779028854; Mon, 23 Oct 2017 10:17:08 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id k19sm1514973wrg.32.2017.10.23.10.17.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:17:08 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [039/nnn] poly_int: pass_store_merging::execute References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 17:17:00 -0000 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <877evlokbw.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/msg01540.txt.bz2 This patch makes pass_store_merging::execute track polynomial sizes and offsets. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * gimple-ssa-store-merging.c (pass_store_merging::execute): Track polynomial sizes and offsets. Index: gcc/gimple-ssa-store-merging.c =================================================================== --- gcc/gimple-ssa-store-merging.c 2017-10-23 17:11:39.971422491 +0100 +++ gcc/gimple-ssa-store-merging.c 2017-10-23 17:18:46.178187802 +0100 @@ -1389,7 +1389,7 @@ pass_store_merging::execute (function *f tree lhs = gimple_assign_lhs (stmt); tree rhs = gimple_assign_rhs1 (stmt); - HOST_WIDE_INT bitsize, bitpos; + poly_int64 bitsize, bitpos; machine_mode mode; int unsignedp = 0, reversep = 0, volatilep = 0; tree offset, base_addr; @@ -1399,8 +1399,6 @@ pass_store_merging::execute (function *f /* As a future enhancement we could handle stores with the same base and offset. */ bool invalid = reversep - || ((bitsize > MAX_BITSIZE_MODE_ANY_INT) - && (TREE_CODE (rhs) != INTEGER_CST)) || !rhs_valid_for_store_merging_p (rhs); /* We do not want to rewrite TARGET_MEM_REFs. */ @@ -1413,23 +1411,17 @@ pass_store_merging::execute (function *f PR 23684 and this way we can catch more chains. */ else if (TREE_CODE (base_addr) == MEM_REF) { - offset_int bit_off, byte_off = mem_ref_offset (base_addr); - bit_off = byte_off << LOG2_BITS_PER_UNIT; + poly_offset_int byte_off = mem_ref_offset (base_addr); + poly_offset_int bit_off = byte_off << LOG2_BITS_PER_UNIT; bit_off += bitpos; - if (!wi::neg_p (bit_off) && wi::fits_shwi_p (bit_off)) - bitpos = bit_off.to_shwi (); - else + if (!bit_off.to_shwi (&bitpos)) invalid = true; base_addr = TREE_OPERAND (base_addr, 0); } /* get_inner_reference returns the base object, get at its address now. */ else - { - if (bitpos < 0) - invalid = true; - base_addr = build_fold_addr_expr (base_addr); - } + base_addr = build_fold_addr_expr (base_addr); if (! invalid && offset != NULL_TREE) @@ -1455,13 +1447,19 @@ pass_store_merging::execute (function *f struct imm_store_chain_info **chain_info = m_stores.get (base_addr); - if (!invalid) + HOST_WIDE_INT const_bitsize, const_bitpos; + if (!invalid + && bitsize.is_constant (&const_bitsize) + && bitpos.is_constant (&const_bitpos) + && (const_bitsize <= MAX_BITSIZE_MODE_ANY_INT + || TREE_CODE (rhs) == INTEGER_CST) + && const_bitpos >= 0) { store_immediate_info *info; if (chain_info) { info = new store_immediate_info ( - bitsize, bitpos, stmt, + const_bitsize, const_bitpos, stmt, (*chain_info)->m_store_info.length ()); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -1490,7 +1488,7 @@ pass_store_merging::execute (function *f /* Start a new chain. */ struct imm_store_chain_info *new_chain = new imm_store_chain_info (m_stores_head, base_addr); - info = new store_immediate_info (bitsize, bitpos, + info = new store_immediate_info (const_bitsize, const_bitpos, stmt, 0); new_chain->m_store_info.safe_push (info); m_stores.put (base_addr, new_chain);