From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 64A9E3857831; Thu, 1 Apr 2021 13:23:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64A9E3857831 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:23:10 +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: 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:23:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99863 --- Comment #13 from Jakub Jelinek --- So, I think we want to do: --- gcc/dse.c.jj 2021-01-28 09:59:11.973750676 +0100 +++ gcc/dse.c 2021-04-01 15:16:22.003913061 +0200 @@ -1970,8 +1970,7 @@ get_stored_val (store_info *store_info, static bool replace_read (store_info *store_info, insn_info_t store_insn, - read_info_t read_info, insn_info_t read_insn, rtx *loc, - bitmap regs_live) + read_info_t read_info, insn_info_t read_insn, rtx *loc) { machine_mode store_mode =3D GET_MODE (store_info->mem); machine_mode read_mode =3D GET_MODE (read_info->mem); @@ -2040,7 +2039,8 @@ replace_read (store_info *store_info, in note_stores (this_insn, look_for_hardregs, regs_set); } - bitmap_and_into (regs_set, regs_live); + if (store_insn->fixed_regs_live) + bitmap_and_into (regs_set, store_insn->fixed_regs_live); if (!bitmap_empty_p (regs_set)) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2286,7 +2286,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t offset - store_info->offse= t, width) && replace_read (store_info, i_ptr, read_info, - insn_info, loc, bb_info->regs_live)) + insn_info, loc)) return; /* The bases are the same, just see if the offsets @@ -2352,8 +2352,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t store_info->width) && all_positions_needed_p (store_info, offset - store_info->offset, width) - && replace_read (store_info, i_ptr, read_info, insn_info, lo= c, - bb_info->regs_live)) + && replace_read (store_info, i_ptr, read_info, insn_info, lo= c)) return; remove =3D canon_true_dependence (store_info->mem, to fix this. Perhaps together with filling fixed_regs_live on more stores, currently we fill it in only for insn with exactly one store or on memset calls, perhaps we want to fill it on insns with more than one store?=