From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDAFC3858C2C; Sat, 1 Oct 2022 23:51:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDAFC3858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664668263; bh=AnsyCOSb5bzLOFfaC24/CagKY7GC3Y4kLlVm2vRX14A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qe6vM55D0DpUnCfsWqoPFko07Mw5D4BCj4G2AZzPJW/xpbuixgpVKNSP/R6QytWlt eWPd/h/1kR+NaByuYZ+PcGhfkVqstKUX8DzEi5YplqNHwAkW6WRRkFuVhofYlg6YRO CGGvnY5twrki7b3G1Cj+xbqFMnr3OIVuABGQq8Bo= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107115] Wrong codegen from TBAA under stores that change effective type? Date: Sat, 01 Oct 2022 23:51:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: component 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107115 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Component|rtl-optimization |middle-end --- Comment #2 from Andrew Pinski --- There are two bugs I think. One in expansion and the other in the RTL optimizers. Without -fno-tree-ter we get: ;; MEM[(long int *)_11] =3D _12; (nil) And then we don't record the aliasing change. This because we had got: ;; _12 =3D *_11; ;; MEM[(long int *)_11] =3D _12; With -fno-tree-ter, we lose it during combine (on the trunk): Trying 16 -> 17: 16: r88:DI=3D[r87:DI] 17: [r87:DI]=3Dr88:DI REG_DEAD r88:DI REG_DEAD r87:DI Failed to match this instruction: (set (mem:DI (reg/f:DI 87 [ _11 ]) [1 MEM[(long int *)_11]+0 S8 A64]) (mem:DI (reg/f:DI 87 [ _11 ]) [2 *_11+0 S8 A64])) allowing combination of insns 16 and 17 original costs 5 + 4 =3D 9 replacement cost 5 deferring deletion of insn with uid =3D 16. modifying insn i3 17: [r87:DI]=3D[r87:DI] REG_DEAD r87:DI deferring rescan insn with uid =3D 17. The aliasing set 1 represents `long` and 2 represents `long long` (see the difference there). I don't know what is the best way to represent an aliasing set change even though the value didn't change on the RTL level. This needed for both expand and combine (and maybe a few other places). I should note the Gimple level was fixed for this testcase between GCC 6.2 = and GCC 6.3 so it would be interesting to find the patch which fixed that.=