From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6ED483844051; Thu, 1 Apr 2021 10:45:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ED483844051 From: "rguenth 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 10:45: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: 11.0 X-Bugzilla-Keywords: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: component 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 10:45:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99863 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization --- Comment #6 from Richard Biener --- (In reply to Richard Biener from comment #5) > (In reply to Martin Li=C5=A1ka from comment #4) > > Started with r10-7268-g529ea7d9596b26ba. >=20 > Reverting on trunk fixes the issue. Good vs. bad assembly shows the like= ly > culprit: >=20 > shrq $32, %rax > - movq %rax, %r8 > - testq %rdi, %rdi > + movq %rax, %rdi > setne %al And this is (insn 6 3 7 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:DI 177 [ u64_0 ]) (const_int 0 [0]))) "t.c":14:30 8 {*cmpdi_ccno_1} (nil)) (insn 7 6 8 2 (set (reg:QI 179) (eq:QI (reg:CCZ 17 flags) (const_int 0 [0]))) "t.c":14:30 802 {*setcc_qi} (expr_list:REG_DEAD (reg:CCZ 17 flags) (nil))) ... (insn 23 22 24 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:DI 177 [ u64_0 ]) (const_int 0 [0]))) "t.c":15:19 8 {*cmpdi_ccno_1} (nil)) (insn 24 23 25 2 (set (reg:QI 190) (ne:QI (reg:CCZ 17 flags) (const_int 0 [0]))) "t.c":15:19 802 {*setcc_qi} (nil)) deferring deletion of insn with uid =3D 23. likely somehow seeing the set as a noop move. trial is (reg:CCZ 17 flags) but likely CSE doesn't track CC flag clobbers appropriately though there's no other CC clobber insn visible at this point. At least CSE1 fails to remove the REG_DEAD note on reg:CCZ in insn 7? Later we happily insert CC clobbers inbetween - notably DSE1 (eh?!) produces (insn 166 12 168 2 (set (reg:SI 262) (subreg:SI (reg:DI 182 [ foo0_v256u32_0 ]) 0)) "t.c":14:36 75 {*movsi_internal} (nil)) (insn 168 166 167 2 (set (reg:DI 263) (reg:DI 182 [ foo0_v256u32_0 ])) "t.c":14:36 74 {*movdi_internal} (expr_list:REG_DEAD (reg:DI 182 [ foo0_v256u32_0 ]) (nil))) (insn 167 168 169 2 (parallel [ (set (reg:DI 263) (lshiftrt:DI (reg:DI 263) (const_int 32 [0x20]))) (clobber (reg:CC 17 flags)) ]) "t.c":14:36 703 {*lshrdi3_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (nil))) which uses subregs/shifts to elide a load/store pair (I think).=