From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5C051385DDE8; Tue, 11 Jun 2024 10:38:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C051385DDE8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718102312; bh=+fgkKFqBEQxdMljYWUfH1wDhJWQmEmkwTB4PmusVTMg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cvjktZUbD04vl2GJB7pml52QR6ke4Z6ElKTBlyKkrRQyHqypjprNGWYhy6CQznftn tOsIhbiKG3RiGCmezANFm/3QRIh2umQ3KbOW2aoAwHOx8bXalw6sJr4lbHqQf0hSGU YlDAmpsHWLdkjCa9sM3B1eP0WL1pGR/S2DyK3FnU= 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: Tue, 11 Jun 2024 10:38:30 +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 #12 from GCC Commits --- The releases/gcc-12 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:7d0673575aba5dfb41022897a882b9c386c332f4 commit r12-10526-g7d0673575aba5dfb41022897a882b9c386c332f4 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)=