From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 63CB43858C30; Tue, 30 Jan 2024 17:53:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63CB43858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706637190; bh=fb5rKFfe7ACfeV5J70p9tqRs7sZlYD4MYmQXw6OtyyY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qrL6GKN9lcnRs4WTLbF6w0nA+7xOGTQk+0XJm4XKC5GXPNw6kgUqkyVEWZUVzJB+2 CZgoQ8Vbg0xvvvix43S5lX3agTeEc32C/d4YdkO0qOjecqf7ulgwGfCDoRJ4uyyOJP EojXZTzKH3r96Wd22ajI7Q/zfmUhNNVIecAFpHTg= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/111444] [14 Regression] Wrong code at -O2/3/s on x86_64-gnu since r14-3226-gd073e2d75d9 Date: Tue, 30 Jan 2024 17:53:09 +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: 14.0 X-Bugzilla-Keywords: alias, 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: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D111444 --- Comment #4 from Jakub Jelinek --- (In reply to Richard Biener from comment #2) > Hmm, so we look for a *(int **) here, reach the toplevel vop, skipping *j= =3D > &e? > That should have conflicted. Seems we actually saw that. walk_non_aliased_vuses calls walker (vn_reference_lookup_2) on .MEM_8 vuse, that still returns NULL, then 3909 if (stmt_may_clobber_ref_p_1 (def_stmt, ref, tbaa_p)) 3910 { 3911 if (!translate) 3912 break; 3913 translate_flags disambiguate_only =3D TR_TRANSLATE; 3914 res =3D (*translate) (ref, vuse, data, &disambiguate_= only); on the def_stmt: # .MEM_8 =3D VDEF <.MEM_7(D)> *j_1(D) =3D &e; returns true from stmt_may_clobber_ref_p_1, correctly saying that *j_1(D) s= tore can clobber *i_1(D). But then walk_non_aliased_vuses calls 3914 res =3D (*translate) (ref, vuse, data, &disambiguate_= only); a few lines later, translate is vn_reference_lookup_3. And vn_reference_lookup_3 calls vn_reference_lookup_2 here in: tree *saved_last_vuse_ptr =3D data->last_vuse_ptr; /* Do not update last_vuse_ptr in vn_reference_lookup_2. */ data->last_vuse_ptr =3D NULL; tree saved_vuse =3D vr->vuse; hashval_t saved_hashcode =3D vr->hashcode; void *res =3D vn_reference_lookup_2 (ref, gimple_vuse (def_st= mt), data); /* Need to restore vr->vuse and vr->hashcode. */ vr->vuse =3D saved_vuse; vr->hashcode =3D saved_hashcode; data->last_vuse_ptr =3D saved_last_vuse_ptr; and def_stmt here is still the *j_1(D) =3D &e; statement, the problem is th= at gimple_vuse (def_stmt) in that case is .MEM_7(D), so it triggers the r14-32= 26 if (SSA_NAME_IS_DEFAULT_DEF (vuse)) stuff at that point. So, do we need to somehow arrange for the if (SSA_NAME_IS_DEFAULT_DEF (vuse)) code to be done solely = when vn_reference_lookup_2 is called directly from walk_non_aliased_vuses and not when called from vn_reference_lookup_3?=