From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BCD9B3858C74; Mon, 8 May 2023 13:49:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCD9B3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683553790; bh=ql9Znrwr1mvwfslT7HzibymQoFpxBLL6FninB8d8DRI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PmL6M5sXCCEVejVXpBzSm/xM2E8AjG8nxDWZqDh33dAO8SPD6jy7Pub/ezwCDtRy8 urlGrnt5Ng3mgCm33nGzw+wlzhqkabgEArffepvXzYCHHiV+rRtt1m3tMiZInmSRmO JBUJAZgHh+ZX4KFIhaJ0bkprVjhEPOhzG0q9m6k0= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106075] Wrong DSE with -fnon-call-exceptions Date: Mon, 08 May 2023 13:49:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: EH, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D106075 --- Comment #12 from rguenther at suse dot de --- On Mon, 8 May 2023, ebotcazou at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106075 >=20 > --- Comment #11 from Eric Botcazou --- > > Eric, maybe you can help with RTL DSE here? >=20 > The problem is that add_non_frame_wild_read is exclusive, i.e. the read is > turned into a read from *only* non-frame memory, but can_throw_external > is conservative and may return true for a read from frame memory: >=20 > (insn 15 13 16 4 (set (reg:QI 87 [ _20 ]) > (mem:QI (plus:DI (reg/f:DI 100) > (reg:DI 92 [ ivtmp.23 ])) [8 MEM > [(interfaces__unsigned_32 *)&value.4 + ivtmp.23_39 * 1]+0 S1 A8])) > "opt47.adb":22:13 91 {*movqi_internal} >=20 > value.4 is a local variable but can_throw_external return true on the rea= d. Ah - interesting. I wonder how the CALL handling is correct in using add_non_frame_wild_read then for the case we pass the address of a frame variable to it. So I suppose add_wild_read () would do the trick. > So you would need to implement an inclusive version of add_non_frame_wild= _read > but the change is going to pessimize Ada and Go if the condition to invok= e it > is not made more precise. So better would be to include the original effects of the insn _plus_ the non-frame wild read effect. I'm defering this for now, the problem went unnoticed for long, so ...=