From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 28F603858004; Mon, 29 Mar 2021 11:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28F603858004 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/99751] [11 Regression] wrong code at -O1 Date: Mon, 29 Mar 2021 11:25:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.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 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: Mon, 29 Mar 2021 11:25:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99751 --- Comment #9 from Jan Hubicka --- OK, so actually there is logic to handle return values (even for consts) bu= t it has wrong if. I am testing the attached fix. diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 7aaf53be8f4..5f33bb5b410 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1545,9 +1545,9 @@ merge_call_lhs_flags (gcall *call, int arg, int index, bool deref, tree lhs =3D gimple_call_lhs (call); analyze_ssa_name_flags (lhs, lattice, depth + 1, ipa); if (deref) - lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]); - else lattice[index].merge_deref (lattice[SSA_NAME_VERSION (lhs)], false); + else + lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]); } /* In the case of memory store we can do nothing. */ else @@ -1621,7 +1621,7 @@ analyze_ssa_name_flags (tree name, vec &lattice, int depth, else if (gcall *call =3D dyn_cast (use_stmt)) { tree callee =3D gimple_call_fndecl (call); - /* Return slot optiomization would require bit of propagation; + /* Return slot optimization would require bit of propagation; give up for now. */ if (gimple_call_return_slot_opt_p (call) && gimple_call_lhs (call) !=3D NULL_TREE=