From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B88F3858422; Mon, 12 Jun 2023 18:55:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B88F3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686596121; bh=3SdJEJZJeqZPUr092ujwiSa1s/KobqbkE7jzRjDxklA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vaCQ/lMxdcH5L8aqRGlX5+E8NNHiE0mR6ndzKOBTwnn75ux7+n/cPOjAwYFikn0SY Pw3Wx1yGxwz4qCl4+T3JCqJnokJ89nFn4pQ9PaVxcVjFA1ULKlHH+DpSLmSW0mOyQW zY6R+N8vpKlCKZJsMM05uIheiXbcgedevksRo+2o= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/101188] [postreload] Uses content of a clobbered register Date: Mon, 12 Jun 2023 18:55:19 +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: 11.1.0 X-Bugzilla-Keywords: ra, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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=3D101188 --- Comment #15 from CVS Commits --- The master branch has been updated by Jeff Law : https://gcc.gnu.org/g:ae193f9008e02683e27f3c87f3b06f38e103b1d0 commit r14-1738-gae193f9008e02683e27f3c87f3b06f38e103b1d0 Author: Jeff Law Date: Mon Jun 12 12:52:10 2023 -0600 [committed] [PR rtl-optimization/101188] Fix reload_cse_move2add ignori= ng clobbers So as Georg-Johann discusses in the BZ, reload_cse_move2add can generate incorrect code when optimizing code with clobbers. Specifically in the case where we try to optimize a sequence of 4 operations down to 3 operations we can reset INSN to the next instruction and continue the l= oop. That skips the code to invalidate objects based on things like REG_INC nodes, stack pushes and most importantly clobbers attached to the curre= nt insn. This patch factors all of the invalidation code used by reload_cse_move= 2add into a new function and calls it at the appropriate time. Georg-Johann has confirmed this patch fixes his avr bug and I've had it= in my tester over the weekend. It's bootstrapped and regression tested on aarch64, m68k, sh4, alpha and hppa. It's also regression tested successfully on a wide variety of other targets. gcc/ PR rtl-optimization/101188 * postreload.cc (reload_cse_move2add_invalidate): New function, extracted from... (reload_cse_move2add): Call reload_cse_move2add_invalidate. gcc/testsuite PR rtl-optimization/101188 * gcc.c-torture/execute/pr101188.c: New test=