From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 35C693857BAB; Thu, 11 Aug 2022 09:22:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35C693857BAB From: "stefansf at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/100960] var-tracking: parameter location in subregister not tracked Date: Thu, 11 Aug 2022 09:22:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stefansf at linux dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 09:22:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100960 --- Comment #4 from Stefan Schulze Frielinghaus --- I really like the idea of enhancing cselib since there is a chance that oth= er passes might profit from it, too. The following patch fixes the initial reported problem: diff --git a/gcc/cselib.cc b/gcc/cselib.cc index 6a5609786fa..64b6996a299 100644 --- a/gcc/cselib.cc +++ b/gcc/cselib.cc @@ -1569,6 +1569,25 @@ new_cselib_val (unsigned int hash, machine_mode mode, rtx x) e->locs =3D 0; e->next_containing_mem =3D 0; + scalar_int_mode int_mode; + if (REG_P (x) && is_int_mode (mode, &int_mode) && REG_VALUES (REGNO (x))= !=3D NULL + && (!cselib_current_insn || !DEBUG_INSN_P (cselib_current_insn))) + { + rtx copy =3D shallow_copy_rtx (x); + scalar_int_mode narrow_mode; + FOR_EACH_MODE_UNTIL(narrow_mode, int_mode) + { + PUT_MODE_RAW (copy, narrow_mode); + cselib_val *v =3D cselib_lookup (copy, narrow_mode, 0, VOIDmode); + if (v) + { + rtx sub =3D lowpart_subreg (narrow_mode, 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); So I get the subvalue relation between 5:5 and 14:14 (was initially 15:15 b= ut changed meanwhile due to new GCC version) (value/u:SI 5:5 @0x4f906e0/0x4f80730) locs: from insn 17 (subreg:SI (value/u:DI 14:14 @0x4f907b8/0x4f808e0) 4) from insn 1 (value/u:SI 6:263 @0x4f906f8/0x4f80760) from insn 1 (entry_value:SI (reg:SI 2 %r2 [ xD.2274 ])) no addrs=