From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7C4FE3858409; Mon, 24 Jan 2022 09:20:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C4FE3858409 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103837] [9/10/11 Regression] '-fcompare-debug' failure (length) w/ -Og -fmove-loop-invariants -fnon-call-exceptions -fno-tree-dce Date: Mon, 24 Jan 2022 09:20:37 +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: 12.0 X-Bugzilla-Keywords: compare-debug-failure X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jan 2022 09:20:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103837 --- Comment #8 from CVS Commits --- The releases/gcc-11 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:06142a317a4e71e509d9e009615adec2fdfa9c67 commit r11-9492-g06142a317a4e71e509d9e009615adec2fdfa9c67 Author: Jakub Jelinek Date: Tue Dec 28 17:40:17 2021 +0100 loop-invariant: Fix -fcompare-debug failure [PR103837] In the following testcase we have a -fcompare-debug failure, because can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions. In the testcase we have due to uninitialized variable: loop_header debug_insn using pseudo84 pseudo84 =3D invariant insn using pseudo84 end loop and with -g decide not to move the pseudo84 =3D invariant before the loop header; in this case not resetting the debug insns might be fine. But, we could have also: pseudo84 =3D whatever loop_header debug_insn using pseudo84 pseudo84 =3D invariant insn using pseudo84 end loop and in that case not resetting the debug insns would result in wrong-de= bug. And, we don't really have generally a good substitution on what pseudo84 contains, it could inherit various values from different paths. So, the following patch ignores DEBUG_INSNs in the decisions, and if th= ere are any that previously prevented the optimization, resets them before return true. 2021-12-28 Jakub Jelinek PR rtl-optimization/103837 * loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs= in the decisions whether to return false or continue and right bef= ore returning true reset those debug insns that previously caused returning false. * gcc.dg/pr103837.c: New test. (cherry picked from commit 3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4)=