From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4713C384AB44; Sun, 21 Apr 2024 04:09:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4713C384AB44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713672585; bh=9RFPsssTxChgu+Tw5QtEQuY8R1IouIwxBX7RbAT+NyA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xWsD0cdo84X2NR0OURYl9xo3GoAo9OA1QNVJZBZGf3GhhvNncxxfttSKoeDlbsEU3 Sg8LpqTgFgoWFmwFeh3RS13+r290zHCkgYv/0IziX/xvnCszBH2prYuZWXjZLOB41+ vGQ51x6aNerDEopOGByNvnmQ+SYzbatCzOTL5uus= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/114768] Volatile reads can be optimized away Date: Sun, 21 Apr 2024 04:09:44 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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=3D114768 --- Comment #10 from GCC Commits --- The releases/gcc-13 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:ab3b83afc149edda11fa3c7cbb3815606731003b commit r13-8636-gab3b83afc149edda11fa3c7cbb3815606731003b Author: Jakub Jelinek Date: Fri Apr 19 08:47:53 2024 +0200 rtlanal: Fix set_noop_p for volatile loads or stores [PR114768] On the following testcase, combine propagates the mem/v load into mem s= tore with the same address and then removes it, because noop_move_p says it = is a no-op move. If it was the other way around, i.e. mem/v store and mem l= oad, or both would be mem/v, it would be kept. The problem is that rtx_equal_p never checks any kind of flags on the r= txes (and I think it would be quite dangerous to change it at this point), a= nd set_noop_p checks side_effects_p on just one of the operands, not both. In the MEM <- MEM set, it only checks it on the destination, in store to ZERO_EXTRACT only checks it on the source. The following patch adds the missing side_effects_p checks. 2024-04-19 Jakub Jelinek PR rtl-optimization/114768 * rtlanal.cc (set_noop_p): Don't return true for MEM <- MEM sets if src has side-effects or for stores into ZERO_EXTRACT if ZERO_EXTRACT operand has side-effects. * gcc.dg/pr114768.c: New test. (cherry picked from commit 9f295847a9c32081bdd0fe908ffba58e830a24fb)=