From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30AC4393BA78; Mon, 5 Dec 2022 16:30:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30AC4393BA78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670257835; bh=9G74HoUsQWNHhC6qWLcl9WQF0Qfzqn6pV2+xSkbfHeU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EWk7s1/BtJstlOGw20l7PhqGCrFZovzpq4YKqdXoglcpGwXzJb3W0XoUIRjYii42w RozfDvAjRE4FYzjHaQ8CsBo7bLcTFMn0HTnSYe0Hus2kLMgCH+j6REyKUA7HQuTk0L y1QPxe85O0cMB4QS0GoqCc2DSzj2PDrVuOGFSboc= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107608] [13 Regression] Failure on fold-overflow-1.c and pr95115.c Date: Mon, 05 Dec 2022 16:30:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D107608 --- Comment #9 from Aldy Hernandez --- (In reply to Richard Biener from comment #8) > (In reply to Aldy Hernandez from comment #7) > > (In reply to Richard Biener from comment #6) > > > (In reply to Jakub Jelinek from comment #0) > > > > ... but then > > > > comes dom2 and happily replaces > > > > _1 =3D 3.4028234663852885981170418348451692544e+38 * 2.0e+0; > > > > return _1; > > > > with > > > > _1 =3D 3.4028234663852885981170418348451692544e+38 * 2.0e+0; > > > > return Inf; > > > > (I think this is still correct) > > >=20 > > > Note this is also a pessimization code-generation wise since if we > > > preserve the multiplication the result is readily available in a > > > register but as optimized we have another constant pool entry and loa= d. > > >=20 > > > So we might want to consider not propagating constants generated by > > > operations > > > we cannot eliminate. If the only consumer is a compare-and-branch we > > > can of course still end up with a seemingly dead stmt, so this would = be only > > > for the missed optimization. > >=20 > > Up to y'all if this is the way to go, but here are some thoughts... > >=20 > > Off the top of my head, we have VRP and DOM propagating constants.=20 > > Technically also simplify_using_ranges, but it's only called from VRP/D= OM, > > and it currently only works with integers, so we should be ok here. > >=20 > > I think we could limit propagation in may_propagate_copy() which both V= RP > > and DOM gate on. VRP uses it through its use of substitute_and_fold_en= gine > > and DOM uses it directly. Would this work? >=20 > I don't think may_propagate_copy is the correct vehicle. Instead the > substitute_and_fold_engine could only substitute from defs with no > side-effects - IIRC it already refrains from propagating _into_ defs > that will be removed after the propagation. So where do you suggest we clamp this? The uses I can think of are VRP (various places in tree-ssa-propagate.cc) and DOM (cprop_operand).=