From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E809384601D; Thu, 1 Apr 2021 13:01:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E809384601D From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/99863] [10/11 Regression] wrong code with -O -fno-tree-forwprop -mno-sse2 since r10-7268-g529ea7d9596b26ba Date: Thu, 01 Apr 2021 13:01:34 +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.0 X-Bugzilla-Keywords: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 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: Thu, 01 Apr 2021 13:01:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99863 --- Comment #12 from Jakub Jelinek --- Ah, I see the actual problem. replace_read checks the hard regs in the insn sequence and compares them to the live hard regs at the point of the read_i= nsn, in the testcase insn 134 after the CC setter 6 and CC users 7 and 40. CC is not live on the insn 134. But we emit that sequence elsewhere: 2076 /* Insert this right before the store insn where it will be s= afe 2077 from later insns that might change it before the read. */ 2078 emit_insn_before (insns, store_insn->insn); and store_insn->insn in this case is insn 19, which is in between insn 7 and 40, and CC is live there. So, I think we need to do this live hard regs testing in record_store inste= ad or in addition to. We already call get_stored_val there just for testing purposes and throw it away afterwards.=