From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C5303858D37; Mon, 12 Feb 2024 14:41:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C5303858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707748894; bh=IYtefXdp194ydYEbedy8iwTuKyUkU+xtyA8AHVxNQl8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tBPff0IdHnN9pL/XP19oR4uP5XxB1Sh7Qjm8R6EUc0CkMvzhcbj1MAZ1NULKn//bw ComShFSLXwouwkkra9IDte8yEnEn/IyOTqVG3vs/KsyjTpdYX11BzaOAeZ/KE/n0U4 thEFO1bE4BEQ7TMJCsiLXr1Ua7rCoEVOodC8XhI4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113847] [14 Regression] 10% slowdown of 462.libquantum on AMD Ryzen 7700X and Ryzen 7900X Date: Mon, 12 Feb 2024 14:41:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D113847 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #4 from Richard Biener --- Hmm, the important one is actually MEM[ptr + CST] vs MEM[ptr].component. B= ut those are not semantically equivalent, even when the same TBAA type is in effect. _31 =3D MEM [(struct quantum_reg *)reg_3(D)]; _33 =3D MEM [(struct quantum_reg *)reg_3(D) + 8B]; _34 =3D MEM [(struct quantum_reg *)reg_3(D) += 16B]; _35 =3D MEM [(struct quantum_reg *)reg_3(D) + 24B]; out =3D quantum_state_collapse.isra (pos_1(D), result_22, _31, _32, _33, = _34, _35); [return slot optimization] this is from inlined quantum_state_collapse where IPA SRA is eventually applied producing the above. That we do produce those might hint at that we can't really assume the dynamic type quantum_reg is at offset 8 but that was the original intent. What we are left with is the special-case where typeof (MEM[ptr + CST]) =3D=3D typeof (alias-pointed-to-type) (with CST =3D=3D 0). For any other c= ase what we know is only that the access MEM[ptr + CST] is to somewhere inside an object of dynamic type quantum_reg? I'm not sure that's not less than we make use of in the alias-oracle, esp. aliasing_component_refs_walk and friends? We might be fine in practice for "bare" MEM_REFs like the above, but if we ever fold only part of the access path into the constant offset funny things may happen? So I think IPA SRA does wrong here (and maybe GCC in other places as well), possibly only pessimizing and possibly creating latent wrong-code. Note quantum_state_collapse has reg$size_62 =3D reg.size; reg$node_75 =3D reg.node; ... pre-IPA. Honza, any opinion?=