From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A22FD38582A3; Wed, 8 Mar 2023 03:37:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A22FD38582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678246649; bh=mZG3NK2lNOmajAaQIdc+WWWX0P/nXHWlLoD3uzCZcAo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cY5GHdc8/EBU3Q77ON3bR4HeUjdFVCidgn17M9K3p4yUI14vHFoisthVJd/UrZ6H5 +nBZLXfG+0BYg7/s/TDWQCwv/uYQFAmJndZqP7Fa8B9Ysz0vDIcbCPkso9UgUmqXjL qqQVnjPlCjQT7oOmfNhokDyiw+LZ0GvtuKj8bF5M= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/109035] meaningless memory store on RISC-V and LoongArch Date: Wed, 08 Mar 2023 03:37:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 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: 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=3D109035 --- Comment #3 from Xi Ruoyao --- (In reply to chenglulu from comment #2) > I think this is most likely caused by the implementation of the public co= de. Agree, so I filled the component as rtl-optimization. I tracked a (non root) cause to the line 1944 in ira-costs.cc: if (i >=3D first_moveable_pseudo && i < last_moveable_pseudo) i_mem_cost =3D 0; else if (equiv_savings < 0) i_mem_cost =3D -equiv_savings; else if (equiv_savings > 0) { i_mem_cost =3D 0; // <=3D=3D=3D=3D=3D=3D HERE for (k =3D cost_classes_ptr->num - 1; k >=3D 0; k--) i_costs[k] +=3D equiv_savings; } I don't really understand why we should prefer the memory if there is a REG_EQUIV note, nor why this does not happen with -fPIE.=