From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7806) id 975143858016; Wed, 28 Sep 2022 15:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 975143858016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664378957; bh=z9lUkEDDymZx4+cbYiHdkO93YHssmMTRZK5NQTs47JY=; h=From:To:Subject:Date:From; b=vhIRCaPfi/6XWMt8z4W5Qbhb5M48KkRNB/Rekv4bcCs1n8Skc5BqYQZSJB4GKCvm/ kR9pafTnZhgXu1MEbbr9xthDHPuSKE211flg6mlt/LZ2MpkXPpzr8KIOJr/Amv7n+M 0DU+VaaYiwFWeNembl8GthxrRcxMLcLUhTH2jY74= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Stefan Schulze Frielinghaus To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2916] cselib: Keep track of further subvalue relations X-Act-Checkin: gcc X-Git-Author: Stefan Schulze Frielinghaus X-Git-Refname: refs/heads/master X-Git-Oldrev: 5e9c4ed903c39f82f28362d9411d4dbc491264ec X-Git-Newrev: d0b00b63a39108311f2e6f9cbe9072579f57df7c Message-Id: <20220928152917.975143858016@sourceware.org> Date: Wed, 28 Sep 2022 15:29:17 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d0b00b63a39108311f2e6f9cbe9072579f57df7c commit r13-2916-gd0b00b63a39108311f2e6f9cbe9072579f57df7c Author: Stefan Schulze Frielinghaus Date: Wed Sep 28 17:27:11 2022 +0200 cselib: Keep track of further subvalue relations Whenever a new cselib value is created check whether a smaller value exists which is contained in the bigger one. If so add a subreg relation to locs of the smaller one. gcc/ChangeLog: * cselib.cc (new_cselib_val): Keep track of further subvalue relations. Diff: --- gcc/cselib.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gcc/cselib.cc b/gcc/cselib.cc index 6a5609786fa..9b582e5d3d6 100644 --- a/gcc/cselib.cc +++ b/gcc/cselib.cc @@ -1569,6 +1569,26 @@ new_cselib_val (unsigned int hash, machine_mode mode, rtx x) e->locs = 0; e->next_containing_mem = 0; + scalar_int_mode int_mode; + if (REG_P (x) && is_int_mode (mode, &int_mode) + && REG_VALUES (REGNO (x)) != NULL + && (!cselib_current_insn || !DEBUG_INSN_P (cselib_current_insn))) + { + rtx copy = shallow_copy_rtx (x); + scalar_int_mode narrow_mode_iter; + FOR_EACH_MODE_UNTIL (narrow_mode_iter, int_mode) + { + PUT_MODE_RAW (copy, narrow_mode_iter); + cselib_val *v = cselib_lookup (copy, narrow_mode_iter, 0, VOIDmode); + if (v) + { + rtx sub = lowpart_subreg (narrow_mode_iter, e->val_rtx, int_mode); + if (sub) + new_elt_loc_list (v, sub); + } + } + } + if (dump_file && (dump_flags & TDF_CSELIB)) { fprintf (dump_file, "cselib value %u:%u ", e->uid, hash);